From ffb32d7f53fe27c65a89b9aef9f7a5736f1234cc Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Sat, 28 Nov 2026 20:10:41 +0530 Subject: [PATCH 01/15] topNavbar --- src/assets/styles/top-navbar.scss | 180 ++++++++++++++++++++++++ src/components/DevDocTemplate/index.tsx | 12 +- 2 files changed, 190 insertions(+), 2 deletions(-) create mode 100644 src/assets/styles/top-navbar.scss diff --git a/src/assets/styles/top-navbar.scss b/src/assets/styles/top-navbar.scss new file mode 100644 index 000000000..843d86bc5 --- /dev/null +++ b/src/assets/styles/top-navbar.scss @@ -0,0 +1,180 @@ +$top-navbar-height: 56px; +$top-navbar-trigger-height: 34px; +$top-navbar-trigger-max-width: 280px; +$top-navbar-panel-width: 320px; +$top-navbar-search-width: 320px; +$top-navbar-mobile-max: 600px; + +.top-navbar-mode { + main { + flex-direction: column; + } + + .leftNavContainer { + flex: 0 0 auto; + width: 100%; + height: auto; + } + + .resizable-container { + width: 100%; + height: auto; + } + + .resizable { + width: 100% !important; + height: auto; + } + + .react-resizable-handle { + display: none; + } + + .menuMain { + width: 100%; + } + + .aside { + display: flex; + flex-direction: row; + align-items: center; + gap: 12px; + left: 0; + width: 100%; + height: $top-navbar-height; + padding: 0 16px; + overflow: visible; + border-right: 0; + border-bottom: 1px solid var(--border-color); + } + + .aside .backButtonWrapper { + display: none; + } + + .aside > nav { + order: 1; + position: relative; + display: flex; + align-items: center; + flex: 0 0 auto; + height: 100%; + margin: 0; + } + + .aside nav > .heading { + position: relative; + display: block; + height: $top-navbar-trigger-height; + max-width: $top-navbar-trigger-max-width; + margin: 0; + padding: 0 32px 0 12px; + font-size: 14px; + font-weight: 600; + line-height: $top-navbar-trigger-height - 2px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + color: var(--primary-color); + background: var(--body-background-color); + border: 1px solid var(--border-color); + border-radius: 6px; + cursor: pointer; + } + + .aside nav > .heading:empty::before { + content: 'Documentation'; + } + + .aside nav > .heading::after { + content: ''; + position: absolute; + right: 12px; + top: calc(50% - 5px); + width: 6px; + height: 6px; + border-right: 1.5px solid currentColor; + border-bottom: 1.5px solid currentColor; + transform: rotate(45deg); + } + + .aside nav > .navWrapper { + display: none; + position: absolute; + top: 100%; + left: 0; + z-index: 30; + width: $top-navbar-panel-width; + max-height: min(70vh, 480px); + margin: 0; + padding: 12px 16px 16px; + overflow-y: auto; + background: var(--left-nav-color); + border: 1px solid var(--border-color); + border-radius: 8px; + box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14); + } + + .aside nav:hover > .navWrapper, + .aside nav:focus-within > .navWrapper { + display: block; + } + + .aside .searchInputLeftNav { + order: 2; + flex: 0 0 auto; + width: $top-navbar-search-width; + max-width: 45%; + margin: 0 0 0 auto; + padding-right: 0; + } + + .documentBody { + flex: 1 1 auto; + height: auto; + min-height: 0; + } + + .introWrapper { + height: 100%; + } + + .documentWrapperContainer, + .docmapWrapper { + height: 100%; + } + + @media screen and (max-width: $top-navbar-mobile-max) { + .aside, + .aside.asideDisplay { + display: flex; + height: $top-navbar-height; + padding: 0 12px; + overflow: visible; + } + + .aside .searchInputLeftNav { + flex: 1 1 0; + width: auto; + min-width: 110px; + max-width: none; + } + + .aside > nav { + flex: 0 1 auto; + min-width: 0; + } + + .aside nav > .heading { + max-width: none; + } + + .aside nav > .navWrapper { + width: min(#{$top-navbar-panel-width}, calc(100vw - 32px)); + } + } +} + +body:has(#wrapper.top-navbar-mode) #floating-assistant-root { + display: none; +} diff --git a/src/components/DevDocTemplate/index.tsx b/src/components/DevDocTemplate/index.tsx index bfb8357ff..85c0b4576 100644 --- a/src/components/DevDocTemplate/index.tsx +++ b/src/components/DevDocTemplate/index.tsx @@ -22,6 +22,7 @@ import Document from '../Document'; import Search from '../Search'; import '../../assets/styles/index.scss'; import '../../assets/styles/radiance-home.css'; +import '../../assets/styles/top-navbar.scss'; import { getAlgoliaIndex } from '../../configs/algolia-search-config'; import RenderPlayGround from './playGround/RESTAPI'; import GraphQLPlayGround from './playGround/GraphQL'; @@ -220,6 +221,10 @@ const isVersionedIframe = VERSION_DROPDOWN.some( typeof window !== 'undefined' && new URLSearchParams(location.search).get('_iframe') === '1'; + const isTopNavbar = + !isPublicSiteOpen && + new URLSearchParams(location.search).get('isTopNavbar') === 'true'; + // The walkthroughs overview is a card-grid landing page (like home) — no // in-page nav to browse, so skip the left sidebar entirely and let the // cards use the full width. tutorials-overview is presented like any other @@ -628,7 +633,7 @@ const isVersionedIframe = VERSION_DROPDOWN.some(
{ - return isEmbeddedContext() ? 'embedded-mode' : ''; + const classNames: string[] = []; + if (isEmbeddedContext()) classNames.push('embedded-mode'); + if (isTopNavbar) classNames.push('top-navbar-mode'); + return classNames.join(' '); }; const getCloudLatestVersion = () => { From 44f34500eaf7d1c9b819f704b575057e67e2e82b Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Sat, 28 Nov 2026 20:26:04 +0530 Subject: [PATCH 02/15] topNavbar --- src/components/DevDocTemplate/index.tsx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/components/DevDocTemplate/index.tsx b/src/components/DevDocTemplate/index.tsx index 85c0b4576..bc22bb969 100644 --- a/src/components/DevDocTemplate/index.tsx +++ b/src/components/DevDocTemplate/index.tsx @@ -221,9 +221,22 @@ const isVersionedIframe = VERSION_DROPDOWN.some( typeof window !== 'undefined' && new URLSearchParams(location.search).get('_iframe') === '1'; - const isTopNavbar = - !isPublicSiteOpen && - new URLSearchParams(location.search).get('isTopNavbar') === 'true'; + const [isTopNavbar] = useState(() => { + if (typeof window === 'undefined' || isPublicSiteOpen) return false; + const topNavbarParam = new URLSearchParams(location.search).get( + 'isTopNavbar', + ); + try { + if (topNavbarParam !== null) { + const enabled = topNavbarParam === 'true'; + localStorage.setItem('isTopNavbar', String(enabled)); + return enabled; + } + return localStorage.getItem('isTopNavbar') === 'true'; + } catch (e) { + return topNavbarParam === 'true'; + } + }); // The walkthroughs overview is a card-grid landing page (like home) — no // in-page nav to browse, so skip the left sidebar entirely and let the From 43710eebf9d2a4fd99c795a9a9836205eaf900f5 Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Sat, 28 Nov 2026 20:37:36 +0530 Subject: [PATCH 03/15] topNavbar --- src/assets/styles/top-navbar.scss | 119 ++++++++++++++++++++++- src/components/DevDocTemplate/index.tsx | 8 ++ src/components/SecondaryHeader/index.tsx | 2 +- 3 files changed, 124 insertions(+), 5 deletions(-) diff --git a/src/assets/styles/top-navbar.scss b/src/assets/styles/top-navbar.scss index 843d86bc5..3ecab9fb8 100644 --- a/src/assets/styles/top-navbar.scss +++ b/src/assets/styles/top-navbar.scss @@ -1,9 +1,14 @@ $top-navbar-height: 56px; $top-navbar-trigger-height: 34px; -$top-navbar-trigger-max-width: 280px; $top-navbar-panel-width: 320px; $top-navbar-search-width: 320px; $top-navbar-mobile-max: 600px; +$top-navbar-nav-width: 240px; +$top-navbar-nav-width-mobile: 34px; +$top-navbar-picker-width: 182px; +$top-navbar-picker-width-mobile: 120px; +$top-navbar-gap: 12px; +$top-navbar-gap-mobile: 8px; .top-navbar-mode { main { @@ -34,6 +39,83 @@ $top-navbar-mobile-max: 600px; width: 100%; } + .secondary-header { + position: absolute; + top: 0; + left: 16px + $top-navbar-nav-width + $top-navbar-gap; + z-index: 40; + width: auto; + height: $top-navbar-height; + background: transparent; + border: 0; + box-shadow: none; + } + + .secondary-header__inner { + padding: 0; + justify-content: flex-start; + } + + .secondary-header__tabs, + .secondary-header__mobile-version, + .secondary-header__nav-toggle { + display: none; + } + + .secondary-header__mobile-left { + display: flex; + } + + .secondary-header__mobile { + display: block; + } + + .secondary-header__mobile-trigger { + height: $top-navbar-trigger-height; + width: $top-navbar-picker-width; + max-width: $top-navbar-picker-width; + padding: 0 12px; + justify-content: space-between; + color: var(--primary-color); + background: var(--body-background-color); + border: 1px solid var(--border-color); + border-radius: 6px; + + &:hover { + color: var(--primary-color); + background: var(--body-background-color); + border-color: var(--secondary-color); + } + } + + .secondary-header__mobile-label { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: 14px; + font-weight: 600; + } + + .secondary-header__mobile-dropdown { + background: var(--left-nav-color); + border: 1px solid var(--border-color); + box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14); + } + + .secondary-header__mobile-item { + color: var(--primary-color); + + &:hover { + color: var(--var-note-color); + background: var(--side-nav-active-bg); + } + + &.active { + color: var(--var-note-color) !important; + background: var(--side-nav-active-bg); + } + } + .aside { display: flex; flex-direction: row; @@ -57,16 +139,19 @@ $top-navbar-mobile-max: 600px; position: relative; display: flex; align-items: center; - flex: 0 0 auto; + flex: 0 0 $top-navbar-nav-width; + min-width: 0; + max-width: $top-navbar-nav-width; height: 100%; - margin: 0; + margin: 0 $top-navbar-picker-width + $top-navbar-gap 0 0; } .aside nav > .heading { position: relative; display: block; height: $top-navbar-trigger-height; - max-width: $top-navbar-trigger-max-width; + width: 100%; + max-width: 100%; margin: 0; padding: 0 32px 0 12px; font-size: 14px; @@ -153,6 +238,32 @@ $top-navbar-mobile-max: 600px; overflow: visible; } + .secondary-header { + left: 12px + $top-navbar-nav-width-mobile + $top-navbar-gap-mobile; + } + + .secondary-header__mobile-trigger { + width: $top-navbar-picker-width-mobile; + max-width: $top-navbar-picker-width-mobile; + padding: 0 8px; + } + + .aside > nav { + flex: 0 0 $top-navbar-nav-width-mobile; + min-width: 0; + margin-right: $top-navbar-picker-width-mobile + $top-navbar-gap-mobile; + } + + .aside nav > .heading { + width: $top-navbar-nav-width-mobile; + padding: 0; + font-size: 0; + + &::after { + right: 13px; + } + } + .aside .searchInputLeftNav { flex: 1 1 0; width: auto; diff --git a/src/components/DevDocTemplate/index.tsx b/src/components/DevDocTemplate/index.tsx index bc22bb969..d5432345e 100644 --- a/src/components/DevDocTemplate/index.tsx +++ b/src/components/DevDocTemplate/index.tsx @@ -911,6 +911,14 @@ if (isVersionedIframe) { setLeftNavOpen={setLeftNavOpen} isVersionedIframe={isVersionedIframe} /> + ) : isTopNavbar ? ( + ) : !isVersionedIframe && !isMaxMobileResolution && ( // In-product presentation has no tabs — show just the nav // toggle so the sidebar stays reachable on narrow viewports. diff --git a/src/components/SecondaryHeader/index.tsx b/src/components/SecondaryHeader/index.tsx index 50a8686fa..501b90606 100644 --- a/src/components/SecondaryHeader/index.tsx +++ b/src/components/SecondaryHeader/index.tsx @@ -194,7 +194,7 @@ const SecondaryHeader = (props: { navigate(`?${params.toString()}`); return; } - navigate(landing); + navigate(`${landing}${location.search || ''}`); }; useEffect(() => { From 3c61023444a77e3c58cf54863a94c08103ade5ec Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Sat, 28 Nov 2026 20:43:41 +0530 Subject: [PATCH 04/15] topNavbar --- src/assets/styles/top-navbar.scss | 51 +++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/src/assets/styles/top-navbar.scss b/src/assets/styles/top-navbar.scss index 3ecab9fb8..a85e02d61 100644 --- a/src/assets/styles/top-navbar.scss +++ b/src/assets/styles/top-navbar.scss @@ -1,5 +1,7 @@ -$top-navbar-height: 56px; -$top-navbar-trigger-height: 34px; +@import './variables.scss'; + +$top-navbar-height: 48px; +$top-navbar-trigger-height: 32px; $top-navbar-panel-width: 320px; $top-navbar-search-width: 320px; $top-navbar-mobile-max: 600px; @@ -74,12 +76,15 @@ $top-navbar-gap-mobile: 8px; height: $top-navbar-trigger-height; width: $top-navbar-picker-width; max-width: $top-navbar-picker-width; - padding: 0 12px; + padding: 0 10px 0 12px; justify-content: space-between; + font-family: $font-family-doc; + font-size: $font-size-normal; color: var(--primary-color); background: var(--body-background-color); border: 1px solid var(--border-color); border-radius: 6px; + transition: border-color 0.15s ease; &:hover { color: var(--primary-color); @@ -92,8 +97,8 @@ $top-navbar-gap-mobile: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; - font-size: 14px; - font-weight: 600; + font-size: $font-size-normal; + font-weight: 400; } .secondary-header__mobile-dropdown { @@ -103,6 +108,8 @@ $top-navbar-gap-mobile: 8px; } .secondary-header__mobile-item { + font-family: $font-family-doc; + font-size: $font-size-normal; color: var(--primary-color); &:hover { @@ -120,12 +127,14 @@ $top-navbar-gap-mobile: 8px; display: flex; flex-direction: row; align-items: center; - gap: 12px; + gap: $top-navbar-gap; left: 0; width: 100%; height: $top-navbar-height; padding: 0 16px; overflow: visible; + font-family: $font-family-doc; + background: var(--left-nav-color); border-right: 0; border-bottom: 1px solid var(--border-color); } @@ -153,9 +162,10 @@ $top-navbar-gap-mobile: 8px; width: 100%; max-width: 100%; margin: 0; - padding: 0 32px 0 12px; - font-size: 14px; - font-weight: 600; + padding: 0 30px 0 12px; + font-family: $font-family-doc; + font-size: $font-size-normal; + font-weight: 400; line-height: $top-navbar-trigger-height - 2px; white-space: nowrap; overflow: hidden; @@ -165,6 +175,11 @@ $top-navbar-gap-mobile: 8px; border: 1px solid var(--border-color); border-radius: 6px; cursor: pointer; + transition: border-color 0.15s ease; + + &:hover { + border-color: var(--secondary-color); + } } .aside nav > .heading:empty::before { @@ -175,7 +190,7 @@ $top-navbar-gap-mobile: 8px; content: ''; position: absolute; right: 12px; - top: calc(50% - 5px); + top: calc(50% - 4px); width: 6px; height: 6px; border-right: 1.5px solid currentColor; @@ -212,6 +227,17 @@ $top-navbar-gap-mobile: 8px; max-width: 45%; margin: 0 0 0 auto; padding-right: 0; + + input { + height: $top-navbar-trigger-height; + font-size: $font-size-normal; + line-height: $top-navbar-trigger-height - 2px; + transition: border-color 0.15s ease; + + &:hover { + border-color: var(--secondary-color); + } + } } .documentBody { @@ -286,6 +312,11 @@ $top-navbar-gap-mobile: 8px; } } +#wrapper.top-navbar-mode[data-theme='dark'] .aside .searchInputLeftNav input { + background: var(--body-background-color); + border-color: var(--border-color); +} + body:has(#wrapper.top-navbar-mode) #floating-assistant-root { display: none; } From 28f881654b8b279923887045bf3c1d9e468f8ea0 Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Sat, 28 Nov 2026 23:10:14 +0530 Subject: [PATCH 05/15] topNavbar --- src/assets/styles/top-navbar.scss | 111 +++++++++++++----------------- 1 file changed, 46 insertions(+), 65 deletions(-) diff --git a/src/assets/styles/top-navbar.scss b/src/assets/styles/top-navbar.scss index a85e02d61..257276577 100644 --- a/src/assets/styles/top-navbar.scss +++ b/src/assets/styles/top-navbar.scss @@ -1,18 +1,18 @@ @import './variables.scss'; -$top-navbar-height: 48px; -$top-navbar-trigger-height: 32px; -$top-navbar-panel-width: 320px; -$top-navbar-search-width: 320px; +$top-navbar-tablet-max: 859px; $top-navbar-mobile-max: 600px; -$top-navbar-nav-width: 240px; -$top-navbar-nav-width-mobile: 34px; -$top-navbar-picker-width: 182px; -$top-navbar-picker-width-mobile: 120px; -$top-navbar-gap: 12px; -$top-navbar-gap-mobile: 8px; .top-navbar-mode { + --tn-pad: 16px; + --tn-gap: 12px; + --tn-bar-h: 48px; + --tn-control-h: 32px; + --tn-nav-w: 240px; + --tn-picker-w: 182px; + --tn-search-w: 320px; + --tn-search-min: 150px; + main { flex-direction: column; } @@ -44,10 +44,10 @@ $top-navbar-gap-mobile: 8px; .secondary-header { position: absolute; top: 0; - left: 16px + $top-navbar-nav-width + $top-navbar-gap; + left: calc(var(--tn-pad) + var(--tn-nav-w) + var(--tn-gap)); z-index: 40; width: auto; - height: $top-navbar-height; + height: var(--tn-bar-h); background: transparent; border: 0; box-shadow: none; @@ -73,9 +73,9 @@ $top-navbar-gap-mobile: 8px; } .secondary-header__mobile-trigger { - height: $top-navbar-trigger-height; - width: $top-navbar-picker-width; - max-width: $top-navbar-picker-width; + width: var(--tn-picker-w); + max-width: var(--tn-picker-w); + height: var(--tn-control-h); padding: 0 10px 0 12px; justify-content: space-between; font-family: $font-family-doc; @@ -127,11 +127,11 @@ $top-navbar-gap-mobile: 8px; display: flex; flex-direction: row; align-items: center; - gap: $top-navbar-gap; + gap: var(--tn-gap); left: 0; width: 100%; - height: $top-navbar-height; - padding: 0 16px; + height: var(--tn-bar-h); + padding: 0 var(--tn-pad); overflow: visible; font-family: $font-family-doc; background: var(--left-nav-color); @@ -148,25 +148,25 @@ $top-navbar-gap-mobile: 8px; position: relative; display: flex; align-items: center; - flex: 0 0 $top-navbar-nav-width; + flex: 0 0 var(--tn-nav-w); min-width: 0; - max-width: $top-navbar-nav-width; + max-width: var(--tn-nav-w); height: 100%; - margin: 0 $top-navbar-picker-width + $top-navbar-gap 0 0; + margin: 0 calc(var(--tn-picker-w) + var(--tn-gap)) 0 0; } .aside nav > .heading { position: relative; display: block; - height: $top-navbar-trigger-height; width: 100%; max-width: 100%; + height: var(--tn-control-h); margin: 0; padding: 0 30px 0 12px; font-family: $font-family-doc; font-size: $font-size-normal; font-weight: 400; - line-height: $top-navbar-trigger-height - 2px; + line-height: calc(var(--tn-control-h) - 2px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; @@ -204,7 +204,7 @@ $top-navbar-gap-mobile: 8px; top: 100%; left: 0; z-index: 30; - width: $top-navbar-panel-width; + width: min(320px, calc(100vw - 2 * var(--tn-pad))); max-height: min(70vh, 480px); margin: 0; padding: 12px 16px 16px; @@ -222,16 +222,17 @@ $top-navbar-gap-mobile: 8px; .aside .searchInputLeftNav { order: 2; - flex: 0 0 auto; - width: $top-navbar-search-width; - max-width: 45%; + flex: 1 1 var(--tn-search-w); + width: auto; + min-width: var(--tn-search-min); + max-width: var(--tn-search-w); margin: 0 0 0 auto; padding-right: 0; input { - height: $top-navbar-trigger-height; + height: var(--tn-control-h); font-size: $font-size-normal; - line-height: $top-navbar-trigger-height - 2px; + line-height: calc(var(--tn-control-h) - 2px); transition: border-color 0.15s ease; &:hover { @@ -255,60 +256,40 @@ $top-navbar-gap-mobile: 8px; height: 100%; } + @media screen and (max-width: $top-navbar-tablet-max) { + --tn-nav-w: 150px; + --tn-picker-w: 150px; + --tn-search-w: 240px; + --tn-search-min: 130px; + } + @media screen and (max-width: $top-navbar-mobile-max) { + --tn-pad: 12px; + --tn-gap: 8px; + --tn-nav-w: 32px; + --tn-picker-w: 118px; + --tn-search-w: 220px; + --tn-search-min: 110px; + .aside, .aside.asideDisplay { display: flex; - height: $top-navbar-height; - padding: 0 12px; + height: var(--tn-bar-h); overflow: visible; } - .secondary-header { - left: 12px + $top-navbar-nav-width-mobile + $top-navbar-gap-mobile; - } - .secondary-header__mobile-trigger { - width: $top-navbar-picker-width-mobile; - max-width: $top-navbar-picker-width-mobile; padding: 0 8px; } - .aside > nav { - flex: 0 0 $top-navbar-nav-width-mobile; - min-width: 0; - margin-right: $top-navbar-picker-width-mobile + $top-navbar-gap-mobile; - } - .aside nav > .heading { - width: $top-navbar-nav-width-mobile; padding: 0; font-size: 0; &::after { - right: 13px; + right: 12px; } } - - .aside .searchInputLeftNav { - flex: 1 1 0; - width: auto; - min-width: 110px; - max-width: none; - } - - .aside > nav { - flex: 0 1 auto; - min-width: 0; - } - - .aside nav > .heading { - max-width: none; - } - - .aside nav > .navWrapper { - width: min(#{$top-navbar-panel-width}, calc(100vw - 32px)); - } } } From 6f676081a2bad1f73427df0bb32dd5145c4a0203 Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Wed, 2 Dec 2026 14:33:23 +0530 Subject: [PATCH 06/15] added hostevent --- src/components/DevDocTemplate/index.tsx | 18 +------ src/configs/doc-configs.js | 4 ++ src/utils/doc-host-events.ts | 21 ++++++++ src/utils/embed-config.ts | 67 +++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 16 deletions(-) create mode 100644 src/utils/doc-host-events.ts create mode 100644 src/utils/embed-config.ts diff --git a/src/components/DevDocTemplate/index.tsx b/src/components/DevDocTemplate/index.tsx index d5432345e..17f7821fc 100644 --- a/src/components/DevDocTemplate/index.tsx +++ b/src/components/DevDocTemplate/index.tsx @@ -13,6 +13,7 @@ import { Analytics } from '@vercel/analytics/react'; import { Seo } from '../Seo'; import { queryStringParser, isPublicSite } from '../../utils/app-utils'; import { useRadianceTheme } from '../../utils/radiance'; +import { useEmbedConfig } from '../../utils/embed-config'; import { passThroughHandler, fetchChild, getPageIdFromHref } from '../../utils/doc-utils'; import Header from '../Header'; import SecondaryHeader, { DocCategory, CATEGORY_PAGEIDS, CATEGORY_NAV_ID } from '../SecondaryHeader'; @@ -221,22 +222,7 @@ const isVersionedIframe = VERSION_DROPDOWN.some( typeof window !== 'undefined' && new URLSearchParams(location.search).get('_iframe') === '1'; - const [isTopNavbar] = useState(() => { - if (typeof window === 'undefined' || isPublicSiteOpen) return false; - const topNavbarParam = new URLSearchParams(location.search).get( - 'isTopNavbar', - ); - try { - if (topNavbarParam !== null) { - const enabled = topNavbarParam === 'true'; - localStorage.setItem('isTopNavbar', String(enabled)); - return enabled; - } - return localStorage.getItem('isTopNavbar') === 'true'; - } catch (e) { - return topNavbarParam === 'true'; - } - }); + const { isTopNavbar } = useEmbedConfig(location.search, !isPublicSiteOpen); // The walkthroughs overview is a card-grid landing page (like home) — no // in-page nav to browse, so skip the left sidebar entirely and let the diff --git a/src/configs/doc-configs.js b/src/configs/doc-configs.js index c73702688..ea512314f 100644 --- a/src/configs/doc-configs.js +++ b/src/configs/doc-configs.js @@ -31,6 +31,10 @@ module.exports = { DEFAULT_PREVIEW_HOST: 'https://try-everywhere.thoughtspot.cloud/v2', DEFAULT_APP_ROOT: '/everywhere', IS_PUBLIC_SITE_OPEN: 'isPublicSiteOpen', + IS_TOP_NAVBAR_PARAM: 'isTopNavbar', + DOC_HOST_EVENTS: { + UPDATE_EMBED_CONFIG: 'updateEmbedConfig', + }, TS_DEMO_LOGIN: '/callosum/v1/session/demo/login', TS_SESSION_TOKEN: '/prism/?op=GetSessionToken', TS_INFO: '/callosum/v1/session/info', diff --git a/src/utils/doc-host-events.ts b/src/utils/doc-host-events.ts new file mode 100644 index 000000000..589865e80 --- /dev/null +++ b/src/utils/doc-host-events.ts @@ -0,0 +1,21 @@ +import { useEffect, useRef } from 'react'; +import { DOC_HOST_EVENTS } from '../configs/doc-configs'; + +export type DocHostEventType = typeof DOC_HOST_EVENTS[keyof typeof DOC_HOST_EVENTS]; + +export const useDocHostEventSubscription = ( + type: DocHostEventType, + handler: (data: Partial) => void, +): void => { + const handlerRef = useRef(handler); + handlerRef.current = handler; + + useEffect(() => { + const listener = (e: MessageEvent) => { + if (e.data?.type !== type) return; + handlerRef.current((e.data?.data || {}) as Partial); + }; + window.addEventListener('message', listener); + return () => window.removeEventListener('message', listener); + }, [type]); +}; diff --git a/src/utils/embed-config.ts b/src/utils/embed-config.ts new file mode 100644 index 000000000..b7fc5d232 --- /dev/null +++ b/src/utils/embed-config.ts @@ -0,0 +1,67 @@ +import { useState } from 'react'; +import { DOC_HOST_EVENTS, IS_TOP_NAVBAR_PARAM } from '../configs/doc-configs'; +import { useDocHostEventSubscription } from './doc-host-events'; + +export interface EmbedConfig { + isTopNavbar: boolean; +} + +export type EmbedConfigKey = keyof EmbedConfig; + +export const parseBoolean = (value: string): boolean => value === 'true'; + +export const parseString = (value: string): string => value; + +interface EmbedConfigParam { + param: string; + parse: (value: string) => V; + defaultValue: V; +} + +type EmbedConfigSchema = { + [K in EmbedConfigKey]: EmbedConfigParam; +}; + +export const EMBED_CONFIG_SCHEMA: EmbedConfigSchema = { + isTopNavbar: { + param: IS_TOP_NAVBAR_PARAM, + parse: parseBoolean, + defaultValue: false, + }, +}; + +const EMBED_CONFIG_KEYS = Object.keys(EMBED_CONFIG_SCHEMA) as EmbedConfigKey[]; + +export const DEFAULT_EMBED_CONFIG: EmbedConfig = EMBED_CONFIG_KEYS.reduce( + (config, key) => ({ + ...config, + [key]: EMBED_CONFIG_SCHEMA[key].defaultValue, + }), + {} as EmbedConfig, +); + +export const getEmbedConfigFromUrl = (search: string): EmbedConfig => { + if (typeof window === 'undefined') return DEFAULT_EMBED_CONFIG; + const params = new URLSearchParams(search); + return EMBED_CONFIG_KEYS.reduce((config, key) => { + const { param, parse } = EMBED_CONFIG_SCHEMA[key]; + const value = params.get(param); + return value === null ? config : { ...config, [key]: parse(value) }; + }, DEFAULT_EMBED_CONFIG); +}; + +export const useEmbedConfig = ( + search: string, + isEmbedded: boolean, +): EmbedConfig => { + const [config, setConfig] = useState(() => + getEmbedConfigFromUrl(search), + ); + + useDocHostEventSubscription( + DOC_HOST_EVENTS.UPDATE_EMBED_CONFIG, + (update) => setConfig((current) => ({ ...current, ...update })), + ); + + return isEmbedded ? config : DEFAULT_EMBED_CONFIG; +}; From 23df68e74f65e80902209246b3913ba7f17a7428 Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Wed, 2 Dec 2026 16:52:57 +0530 Subject: [PATCH 07/15] added hostevent --- src/utils/embed-config.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/utils/embed-config.ts b/src/utils/embed-config.ts index b7fc5d232..3600ae8a0 100644 --- a/src/utils/embed-config.ts +++ b/src/utils/embed-config.ts @@ -10,8 +10,6 @@ export type EmbedConfigKey = keyof EmbedConfig; export const parseBoolean = (value: string): boolean => value === 'true'; -export const parseString = (value: string): string => value; - interface EmbedConfigParam { param: string; parse: (value: string) => V; From a8bff6dcb9679dcac5ba08479c9de09e9fde96fc Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Wed, 2 Dec 2026 17:06:29 +0530 Subject: [PATCH 08/15] added the dark and light tmode by host event --- src/components/DevDocTemplate/index.tsx | 8 +++++++- src/configs/doc-configs.js | 1 + src/utils/embed-config.ts | 12 +++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/components/DevDocTemplate/index.tsx b/src/components/DevDocTemplate/index.tsx index 17f7821fc..0d83834da 100644 --- a/src/components/DevDocTemplate/index.tsx +++ b/src/components/DevDocTemplate/index.tsx @@ -222,7 +222,13 @@ const isVersionedIframe = VERSION_DROPDOWN.some( typeof window !== 'undefined' && new URLSearchParams(location.search).get('_iframe') === '1'; - const { isTopNavbar } = useEmbedConfig(location.search, !isPublicSiteOpen); + const embedConfig = useEmbedConfig(location.search, !isPublicSiteOpen); + const { isTopNavbar } = embedConfig; + + useEffect(() => { + if (isPublicSiteOpen) return; + setDarkMode(embedConfig.isDarkMode); + }, [embedConfig.isDarkMode, isPublicSiteOpen]); // The walkthroughs overview is a card-grid landing page (like home) — no // in-page nav to browse, so skip the left sidebar entirely and let the diff --git a/src/configs/doc-configs.js b/src/configs/doc-configs.js index ea512314f..6dd30a151 100644 --- a/src/configs/doc-configs.js +++ b/src/configs/doc-configs.js @@ -32,6 +32,7 @@ module.exports = { DEFAULT_APP_ROOT: '/everywhere', IS_PUBLIC_SITE_OPEN: 'isPublicSiteOpen', IS_TOP_NAVBAR_PARAM: 'isTopNavbar', + IS_DARK_MODE_PARAM: 'isDarkMode', DOC_HOST_EVENTS: { UPDATE_EMBED_CONFIG: 'updateEmbedConfig', }, diff --git a/src/utils/embed-config.ts b/src/utils/embed-config.ts index 3600ae8a0..afccfb0fa 100644 --- a/src/utils/embed-config.ts +++ b/src/utils/embed-config.ts @@ -1,8 +1,13 @@ import { useState } from 'react'; -import { DOC_HOST_EVENTS, IS_TOP_NAVBAR_PARAM } from '../configs/doc-configs'; +import { + DOC_HOST_EVENTS, + IS_DARK_MODE_PARAM, + IS_TOP_NAVBAR_PARAM, +} from '../configs/doc-configs'; import { useDocHostEventSubscription } from './doc-host-events'; export interface EmbedConfig { + isDarkMode: boolean; isTopNavbar: boolean; } @@ -21,6 +26,11 @@ type EmbedConfigSchema = { }; export const EMBED_CONFIG_SCHEMA: EmbedConfigSchema = { + isDarkMode: { + param: IS_DARK_MODE_PARAM, + parse: parseBoolean, + defaultValue: false, + }, isTopNavbar: { param: IS_TOP_NAVBAR_PARAM, parse: parseBoolean, From 3e60b3efa56b143d415fb5e9e56d42db7c74ad53 Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Wed, 2 Dec 2026 17:32:23 +0530 Subject: [PATCH 09/15] added the dark and light tmode by host event --- src/components/DevDocTemplate/index.tsx | 19 +++---- src/utils/doc-host-events.ts | 22 +++------ src/utils/embed-config.ts | 66 ++++++++++++++++--------- 3 files changed, 62 insertions(+), 45 deletions(-) diff --git a/src/components/DevDocTemplate/index.tsx b/src/components/DevDocTemplate/index.tsx index 0d83834da..d0416669f 100644 --- a/src/components/DevDocTemplate/index.tsx +++ b/src/components/DevDocTemplate/index.tsx @@ -13,7 +13,7 @@ import { Analytics } from '@vercel/analytics/react'; import { Seo } from '../Seo'; import { queryStringParser, isPublicSite } from '../../utils/app-utils'; import { useRadianceTheme } from '../../utils/radiance'; -import { useEmbedConfig } from '../../utils/embed-config'; +import { getEmbedConfig, useEmbedConfig } from '../../utils/embed-config'; import { passThroughHandler, fetchChild, getPageIdFromHref } from '../../utils/doc-utils'; import Header from '../Header'; import SecondaryHeader, { DocCategory, CATEGORY_PAGEIDS, CATEGORY_NAV_ID } from '../SecondaryHeader'; @@ -140,6 +140,13 @@ const DevDocTemplate: FC = (props) => { }); const [isDarkMode, setDarkMode] = useState(() => { if (typeof window === 'undefined') return false; + if (!isPublicSite(location.search)) { + const { isDarkMode: hostDarkMode } = getEmbedConfig(); + if (hostDarkMode !== null) return hostDarkMode; + const storedChoice = localStorage.getItem('themeMode'); + if (storedChoice) return storedChoice === 'dark'; + return false; + } // URL param takes highest priority (set by embedding product to pass its theme). const urlParams = new URLSearchParams(window.location.search); const darkModeParam = urlParams.get('isDarkMode'); @@ -148,12 +155,6 @@ const DevDocTemplate: FC = (props) => { localStorage.setItem('themeMode', isDark ? 'dark' : 'light'); return isDark; } - // In-product (embedded) presentation always uses light mode — product UI has no theme toggle. - if (!isPublicSite(location.search)){ - const explicitChoice = localStorage.getItem('themeMode'); - if (explicitChoice) return explicitChoice === 'dark'; - return false; - } /* themeMode is only written when the user explicitly clicks the toggle. If absent, follow OS preference fresh every load. */ const explicitChoice = localStorage.getItem('themeMode'); @@ -222,11 +223,11 @@ const isVersionedIframe = VERSION_DROPDOWN.some( typeof window !== 'undefined' && new URLSearchParams(location.search).get('_iframe') === '1'; - const embedConfig = useEmbedConfig(location.search, !isPublicSiteOpen); + const embedConfig = useEmbedConfig(!isPublicSiteOpen); const { isTopNavbar } = embedConfig; useEffect(() => { - if (isPublicSiteOpen) return; + if (isPublicSiteOpen || embedConfig.isDarkMode === null) return; setDarkMode(embedConfig.isDarkMode); }, [embedConfig.isDarkMode, isPublicSiteOpen]); diff --git a/src/utils/doc-host-events.ts b/src/utils/doc-host-events.ts index 589865e80..2a6fedc59 100644 --- a/src/utils/doc-host-events.ts +++ b/src/utils/doc-host-events.ts @@ -1,21 +1,15 @@ -import { useEffect, useRef } from 'react'; import { DOC_HOST_EVENTS } from '../configs/doc-configs'; export type DocHostEventType = typeof DOC_HOST_EVENTS[keyof typeof DOC_HOST_EVENTS]; -export const useDocHostEventSubscription = ( +export const subscribeToDocHostEvent = ( type: DocHostEventType, handler: (data: Partial) => void, -): void => { - const handlerRef = useRef(handler); - handlerRef.current = handler; - - useEffect(() => { - const listener = (e: MessageEvent) => { - if (e.data?.type !== type) return; - handlerRef.current((e.data?.data || {}) as Partial); - }; - window.addEventListener('message', listener); - return () => window.removeEventListener('message', listener); - }, [type]); +): (() => void) => { + const listener = (e: MessageEvent) => { + if (e.data?.type !== type) return; + handler((e.data?.data || {}) as Partial); + }; + window.addEventListener('message', listener); + return () => window.removeEventListener('message', listener); }; diff --git a/src/utils/embed-config.ts b/src/utils/embed-config.ts index afccfb0fa..91e091b34 100644 --- a/src/utils/embed-config.ts +++ b/src/utils/embed-config.ts @@ -1,19 +1,19 @@ -import { useState } from 'react'; +import { useEffect, useState } from 'react'; import { DOC_HOST_EVENTS, IS_DARK_MODE_PARAM, IS_TOP_NAVBAR_PARAM, } from '../configs/doc-configs'; -import { useDocHostEventSubscription } from './doc-host-events'; +import { subscribeToDocHostEvent } from './doc-host-events'; export interface EmbedConfig { - isDarkMode: boolean; + isDarkMode: boolean | null; isTopNavbar: boolean; } -export type EmbedConfigKey = keyof EmbedConfig; +type EmbedConfigKey = keyof EmbedConfig; -export const parseBoolean = (value: string): boolean => value === 'true'; +const parseBoolean = (value: string): boolean => value === 'true'; interface EmbedConfigParam { param: string; @@ -25,11 +25,11 @@ type EmbedConfigSchema = { [K in EmbedConfigKey]: EmbedConfigParam; }; -export const EMBED_CONFIG_SCHEMA: EmbedConfigSchema = { +const EMBED_CONFIG_SCHEMA: EmbedConfigSchema = { isDarkMode: { param: IS_DARK_MODE_PARAM, parse: parseBoolean, - defaultValue: false, + defaultValue: null, }, isTopNavbar: { param: IS_TOP_NAVBAR_PARAM, @@ -40,7 +40,7 @@ export const EMBED_CONFIG_SCHEMA: EmbedConfigSchema = { const EMBED_CONFIG_KEYS = Object.keys(EMBED_CONFIG_SCHEMA) as EmbedConfigKey[]; -export const DEFAULT_EMBED_CONFIG: EmbedConfig = EMBED_CONFIG_KEYS.reduce( +const DEFAULT_EMBED_CONFIG: EmbedConfig = EMBED_CONFIG_KEYS.reduce( (config, key) => ({ ...config, [key]: EMBED_CONFIG_SCHEMA[key].defaultValue, @@ -48,28 +48,50 @@ export const DEFAULT_EMBED_CONFIG: EmbedConfig = EMBED_CONFIG_KEYS.reduce( {} as EmbedConfig, ); -export const getEmbedConfigFromUrl = (search: string): EmbedConfig => { - if (typeof window === 'undefined') return DEFAULT_EMBED_CONFIG; - const params = new URLSearchParams(search); - return EMBED_CONFIG_KEYS.reduce((config, key) => { +const getEmbedConfigFromUrl = (search: string): EmbedConfig => + EMBED_CONFIG_KEYS.reduce((config, key) => { const { param, parse } = EMBED_CONFIG_SCHEMA[key]; - const value = params.get(param); + const value = new URLSearchParams(search).get(param); return value === null ? config : { ...config, [key]: parse(value) }; }, DEFAULT_EMBED_CONFIG); + +let embedConfig: EmbedConfig | null = null; +const listeners = new Set<() => void>(); + +export const getEmbedConfig = (): EmbedConfig => { + if (typeof window === 'undefined') return DEFAULT_EMBED_CONFIG; + if (!embedConfig) { + embedConfig = getEmbedConfigFromUrl(window.location.search); + } + return embedConfig; }; -export const useEmbedConfig = ( - search: string, - isEmbedded: boolean, -): EmbedConfig => { - const [config, setConfig] = useState(() => - getEmbedConfigFromUrl(search), - ); +const setEmbedConfig = (update: Partial): void => { + const current = getEmbedConfig(); + const next = { ...current, ...update }; + if (EMBED_CONFIG_KEYS.every((key) => next[key] === current[key])) return; + embedConfig = next; + listeners.forEach((listener) => listener()); +}; - useDocHostEventSubscription( +if (typeof window !== 'undefined') { + subscribeToDocHostEvent( DOC_HOST_EVENTS.UPDATE_EMBED_CONFIG, - (update) => setConfig((current) => ({ ...current, ...update })), + setEmbedConfig, ); +} + +export const useEmbedConfig = (isEmbedded: boolean): EmbedConfig => { + const [config, setConfig] = useState(getEmbedConfig); + + useEffect(() => { + const listener = () => setConfig(getEmbedConfig()); + listener(); + listeners.add(listener); + return () => { + listeners.delete(listener); + }; + }, []); return isEmbedded ? config : DEFAULT_EMBED_CONFIG; }; From 163e2beca331795dd2d5b4a78b3a9b684586d176 Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Thu, 3 Dec 2026 08:35:13 +0530 Subject: [PATCH 10/15] topNavbar exisitn post page flow --- src/components/DevDocTemplate/index.tsx | 14 ++++++-- src/utils/doc-host-events.ts | 15 -------- src/utils/embed-config.ts | 47 +++---------------------- 3 files changed, 15 insertions(+), 61 deletions(-) delete mode 100644 src/utils/doc-host-events.ts diff --git a/src/components/DevDocTemplate/index.tsx b/src/components/DevDocTemplate/index.tsx index d0416669f..9100fe887 100644 --- a/src/components/DevDocTemplate/index.tsx +++ b/src/components/DevDocTemplate/index.tsx @@ -13,7 +13,7 @@ import { Analytics } from '@vercel/analytics/react'; import { Seo } from '../Seo'; import { queryStringParser, isPublicSite } from '../../utils/app-utils'; import { useRadianceTheme } from '../../utils/radiance'; -import { getEmbedConfig, useEmbedConfig } from '../../utils/embed-config'; +import { EmbedConfig, getEmbedConfig } from '../../utils/embed-config'; import { passThroughHandler, fetchChild, getPageIdFromHref } from '../../utils/doc-utils'; import Header from '../Header'; import SecondaryHeader, { DocCategory, CATEGORY_PAGEIDS, CATEGORY_NAV_ID } from '../SecondaryHeader'; @@ -44,6 +44,7 @@ import { CUSTOM_PAGE_ID, BUILD_ENVS, VERSION_DROPDOWN, + DOC_HOST_EVENTS, } from '../../configs/doc-configs'; import { LEFT_NAV_WIDTH_DESKTOP, @@ -223,8 +224,8 @@ const isVersionedIframe = VERSION_DROPDOWN.some( typeof window !== 'undefined' && new URLSearchParams(location.search).get('_iframe') === '1'; - const embedConfig = useEmbedConfig(!isPublicSiteOpen); - const { isTopNavbar } = embedConfig; + const [embedConfig, setEmbedConfig] = useState(getEmbedConfig); + const isTopNavbar = !isPublicSiteOpen && embedConfig.isTopNavbar; useEffect(() => { if (isPublicSiteOpen || embedConfig.isDarkMode === null) return; @@ -443,6 +444,13 @@ const isVersionedIframe = VERSION_DROPDOWN.some( // Listen for messages from the iframe useEffect(() => { const handleMessage = (e) => { + if ( + e.data?.type === DOC_HOST_EVENTS.UPDATE_EMBED_CONFIG && + e.data?.data + ) { + setEmbedConfig(e.data.data); + return; + } if (e.data?.params || e.data?.subsection) { console.log('Iframe message:', e.data); diff --git a/src/utils/doc-host-events.ts b/src/utils/doc-host-events.ts deleted file mode 100644 index 2a6fedc59..000000000 --- a/src/utils/doc-host-events.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { DOC_HOST_EVENTS } from '../configs/doc-configs'; - -export type DocHostEventType = typeof DOC_HOST_EVENTS[keyof typeof DOC_HOST_EVENTS]; - -export const subscribeToDocHostEvent = ( - type: DocHostEventType, - handler: (data: Partial) => void, -): (() => void) => { - const listener = (e: MessageEvent) => { - if (e.data?.type !== type) return; - handler((e.data?.data || {}) as Partial); - }; - window.addEventListener('message', listener); - return () => window.removeEventListener('message', listener); -}; diff --git a/src/utils/embed-config.ts b/src/utils/embed-config.ts index 91e091b34..c3b82ccd7 100644 --- a/src/utils/embed-config.ts +++ b/src/utils/embed-config.ts @@ -1,10 +1,7 @@ -import { useEffect, useState } from 'react'; import { - DOC_HOST_EVENTS, IS_DARK_MODE_PARAM, IS_TOP_NAVBAR_PARAM, } from '../configs/doc-configs'; -import { subscribeToDocHostEvent } from './doc-host-events'; export interface EmbedConfig { isDarkMode: boolean | null; @@ -55,43 +52,7 @@ const getEmbedConfigFromUrl = (search: string): EmbedConfig => return value === null ? config : { ...config, [key]: parse(value) }; }, DEFAULT_EMBED_CONFIG); -let embedConfig: EmbedConfig | null = null; -const listeners = new Set<() => void>(); - -export const getEmbedConfig = (): EmbedConfig => { - if (typeof window === 'undefined') return DEFAULT_EMBED_CONFIG; - if (!embedConfig) { - embedConfig = getEmbedConfigFromUrl(window.location.search); - } - return embedConfig; -}; - -const setEmbedConfig = (update: Partial): void => { - const current = getEmbedConfig(); - const next = { ...current, ...update }; - if (EMBED_CONFIG_KEYS.every((key) => next[key] === current[key])) return; - embedConfig = next; - listeners.forEach((listener) => listener()); -}; - -if (typeof window !== 'undefined') { - subscribeToDocHostEvent( - DOC_HOST_EVENTS.UPDATE_EMBED_CONFIG, - setEmbedConfig, - ); -} - -export const useEmbedConfig = (isEmbedded: boolean): EmbedConfig => { - const [config, setConfig] = useState(getEmbedConfig); - - useEffect(() => { - const listener = () => setConfig(getEmbedConfig()); - listener(); - listeners.add(listener); - return () => { - listeners.delete(listener); - }; - }, []); - - return isEmbedded ? config : DEFAULT_EMBED_CONFIG; -}; +export const getEmbedConfig = (): EmbedConfig => + typeof window === 'undefined' + ? DEFAULT_EMBED_CONFIG + : getEmbedConfigFromUrl(window.location.search); From 9028a2f5d118798adfec3faf231cc17b7e4de308 Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Thu, 3 Dec 2026 14:13:16 +0530 Subject: [PATCH 11/15] topnavbar --- src/assets/styles/top-navbar.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/assets/styles/top-navbar.scss b/src/assets/styles/top-navbar.scss index 257276577..73390626f 100644 --- a/src/assets/styles/top-navbar.scss +++ b/src/assets/styles/top-navbar.scss @@ -4,12 +4,12 @@ $top-navbar-tablet-max: 859px; $top-navbar-mobile-max: 600px; .top-navbar-mode { - --tn-pad: 16px; + --tn-pad: 24px; --tn-gap: 12px; - --tn-bar-h: 48px; + --tn-bar-h: 52px; --tn-control-h: 32px; - --tn-nav-w: 240px; - --tn-picker-w: 182px; + --tn-nav-w: 250px; + --tn-picker-w: 200px; --tn-search-w: 320px; --tn-search-min: 150px; From 613cc521a17934e55d990b60545016b07e01bec4 Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Thu, 3 Dec 2026 14:19:37 +0530 Subject: [PATCH 12/15] topnavbar --- src/assets/styles/top-navbar.scss | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/assets/styles/top-navbar.scss b/src/assets/styles/top-navbar.scss index 73390626f..fa959a8f2 100644 --- a/src/assets/styles/top-navbar.scss +++ b/src/assets/styles/top-navbar.scss @@ -12,9 +12,11 @@ $top-navbar-mobile-max: 600px; --tn-picker-w: 200px; --tn-search-w: 320px; --tn-search-min: 150px; + --tn-dropdown-shadow: 0 8px 24px rgba(0, 0, 0, 0.14); main { flex-direction: column; + height: 100lvh !important; } .leftNavContainer { @@ -102,9 +104,10 @@ $top-navbar-mobile-max: 600px; } .secondary-header__mobile-dropdown { + min-width: var(--tn-picker-w); background: var(--left-nav-color); border: 1px solid var(--border-color); - box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14); + box-shadow: var(--tn-dropdown-shadow); } .secondary-header__mobile-item { @@ -175,6 +178,7 @@ $top-navbar-mobile-max: 600px; border: 1px solid var(--border-color); border-radius: 6px; cursor: pointer; + user-select: none; transition: border-color 0.15s ease; &:hover { @@ -205,14 +209,14 @@ $top-navbar-mobile-max: 600px; left: 0; z-index: 30; width: min(320px, calc(100vw - 2 * var(--tn-pad))); - max-height: min(70vh, 480px); + max-height: 70vh; margin: 0; padding: 12px 16px 16px; overflow-y: auto; background: var(--left-nav-color); border: 1px solid var(--border-color); border-radius: 8px; - box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14); + box-shadow: var(--tn-dropdown-shadow); } .aside nav:hover > .navWrapper, @@ -233,6 +237,7 @@ $top-navbar-mobile-max: 600px; height: var(--tn-control-h); font-size: $font-size-normal; line-height: calc(var(--tn-control-h) - 2px); + border-color: var(--border-color); transition: border-color 0.15s ease; &:hover { @@ -290,12 +295,20 @@ $top-navbar-mobile-max: 600px; right: 12px; } } + + .aside .active { + color: var(--var-note-color) !important; + } } } -#wrapper.top-navbar-mode[data-theme='dark'] .aside .searchInputLeftNav input { - background: var(--body-background-color); - border-color: var(--border-color); +#wrapper.top-navbar-mode[data-theme='dark'] { + --tn-dropdown-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); + + .aside .searchInputLeftNav input { + background: var(--body-background-color); + border-color: var(--border-color); + } } body:has(#wrapper.top-navbar-mode) #floating-assistant-root { From 4c4bba23a93b0f2f95731855162296323c33c317 Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Fri, 4 Dec 2026 21:07:11 +0530 Subject: [PATCH 13/15] topNavbar --- src/assets/styles/top-navbar.scss | 9 +++++++++ src/components/DevDocTemplate/index.tsx | 2 ++ src/configs/doc-configs.js | 1 + src/utils/embed-config.ts | 7 +++++++ 4 files changed, 19 insertions(+) diff --git a/src/assets/styles/top-navbar.scss b/src/assets/styles/top-navbar.scss index fa959a8f2..778a42520 100644 --- a/src/assets/styles/top-navbar.scss +++ b/src/assets/styles/top-navbar.scss @@ -2,6 +2,7 @@ $top-navbar-tablet-max: 859px; $top-navbar-mobile-max: 600px; +$spotter-code-launcher-clearance: 80px; .top-navbar-mode { --tn-pad: 24px; @@ -314,3 +315,11 @@ $top-navbar-mobile-max: 600px; body:has(#wrapper.top-navbar-mode) #floating-assistant-root { display: none; } + +body:has(#wrapper.hide-spotter-code) #floating-assistant-root { + display: none; +} + +#wrapper.hide-spotter-code:not(.top-navbar-mode) .leftNavContainer { + margin-bottom: $spotter-code-launcher-clearance; +} diff --git a/src/components/DevDocTemplate/index.tsx b/src/components/DevDocTemplate/index.tsx index 9100fe887..ab5d6cbb7 100644 --- a/src/components/DevDocTemplate/index.tsx +++ b/src/components/DevDocTemplate/index.tsx @@ -226,6 +226,7 @@ const isVersionedIframe = VERSION_DROPDOWN.some( const [embedConfig, setEmbedConfig] = useState(getEmbedConfig); const isTopNavbar = !isPublicSiteOpen && embedConfig.isTopNavbar; + const hideSpotterCode = !isPublicSiteOpen && embedConfig.hideSpotterCode; useEffect(() => { if (isPublicSiteOpen || embedConfig.isDarkMode === null) return; @@ -759,6 +760,7 @@ if (isVersionedIframe) { const classNames: string[] = []; if (isEmbeddedContext()) classNames.push('embedded-mode'); if (isTopNavbar) classNames.push('top-navbar-mode'); + if (hideSpotterCode) classNames.push('hide-spotter-code'); return classNames.join(' '); }; diff --git a/src/configs/doc-configs.js b/src/configs/doc-configs.js index 6dd30a151..4edae0ea4 100644 --- a/src/configs/doc-configs.js +++ b/src/configs/doc-configs.js @@ -33,6 +33,7 @@ module.exports = { IS_PUBLIC_SITE_OPEN: 'isPublicSiteOpen', IS_TOP_NAVBAR_PARAM: 'isTopNavbar', IS_DARK_MODE_PARAM: 'isDarkMode', + HIDE_SPOTTER_CODE_PARAM: 'hideSpotterCode', DOC_HOST_EVENTS: { UPDATE_EMBED_CONFIG: 'updateEmbedConfig', }, diff --git a/src/utils/embed-config.ts b/src/utils/embed-config.ts index c3b82ccd7..4b59350eb 100644 --- a/src/utils/embed-config.ts +++ b/src/utils/embed-config.ts @@ -1,4 +1,5 @@ import { + HIDE_SPOTTER_CODE_PARAM, IS_DARK_MODE_PARAM, IS_TOP_NAVBAR_PARAM, } from '../configs/doc-configs'; @@ -6,6 +7,7 @@ import { export interface EmbedConfig { isDarkMode: boolean | null; isTopNavbar: boolean; + hideSpotterCode: boolean; } type EmbedConfigKey = keyof EmbedConfig; @@ -33,6 +35,11 @@ const EMBED_CONFIG_SCHEMA: EmbedConfigSchema = { parse: parseBoolean, defaultValue: false, }, + hideSpotterCode: { + param: HIDE_SPOTTER_CODE_PARAM, + parse: parseBoolean, + defaultValue: false, + }, }; const EMBED_CONFIG_KEYS = Object.keys(EMBED_CONFIG_SCHEMA) as EmbedConfigKey[]; From e878f8fa884b2d391f8b5eef20ed569120c79649 Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Sat, 5 Dec 2026 14:33:47 +0530 Subject: [PATCH 14/15] topNavbar --- src/assets/styles/top-navbar.scss | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/assets/styles/top-navbar.scss b/src/assets/styles/top-navbar.scss index 778a42520..b402a665c 100644 --- a/src/assets/styles/top-navbar.scss +++ b/src/assets/styles/top-navbar.scss @@ -206,7 +206,7 @@ $spotter-code-launcher-clearance: 80px; .aside nav > .navWrapper { display: none; position: absolute; - top: 100%; + top: calc(100% + 6px); left: 0; z-index: 30; width: min(320px, calc(100vw - 2 * var(--tn-pad))); @@ -220,6 +220,15 @@ $spotter-code-launcher-clearance: 80px; box-shadow: var(--tn-dropdown-shadow); } + .aside > nav::after { + content: ''; + position: absolute; + top: 100%; + left: 0; + width: 100%; + height: 6px; + } + .aside nav:hover > .navWrapper, .aside nav:focus-within > .navWrapper { display: block; @@ -321,5 +330,17 @@ body:has(#wrapper.hide-spotter-code) #floating-assistant-root { } #wrapper.hide-spotter-code:not(.top-navbar-mode) .leftNavContainer { + position: relative; margin-bottom: $spotter-code-launcher-clearance; + + &::after { + content: ''; + position: absolute; + top: 100%; + left: 0; + right: 0; + height: $spotter-code-launcher-clearance; + background: var(--left-nav-color); + border-right: 1px solid var(--border-color); + } } From 14d3dd67063858421b43b2b76d63ff166991cfdc Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Sat, 5 Dec 2026 19:51:08 +0530 Subject: [PATCH 15/15] topNavbar --- src/assets/styles/top-navbar.scss | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/assets/styles/top-navbar.scss b/src/assets/styles/top-navbar.scss index b402a665c..67ca409c1 100644 --- a/src/assets/styles/top-navbar.scss +++ b/src/assets/styles/top-navbar.scss @@ -329,18 +329,6 @@ body:has(#wrapper.hide-spotter-code) #floating-assistant-root { display: none; } -#wrapper.hide-spotter-code:not(.top-navbar-mode) .leftNavContainer { - position: relative; - margin-bottom: $spotter-code-launcher-clearance; - - &::after { - content: ''; - position: absolute; - top: 100%; - left: 0; - right: 0; - height: $spotter-code-launcher-clearance; - background: var(--left-nav-color); - border-right: 1px solid var(--border-color); - } +#wrapper.hide-spotter-code:not(.top-navbar-mode) .aside > nav { + padding-bottom: $spotter-code-launcher-clearance; }