diff --git a/.changeset/gorgeous-horses-grow.md b/.changeset/gorgeous-horses-grow.md new file mode 100644 index 000000000..62e013835 --- /dev/null +++ b/.changeset/gorgeous-horses-grow.md @@ -0,0 +1,5 @@ +--- +'gitbook': patch +--- + +Position the variant picker in the ToC diff --git a/packages/gitbook/src/components/Header/Dropdown.tsx b/packages/gitbook/src/components/Header/Dropdown.tsx index 2ce03cc72..b1d2f5b4a 100644 --- a/packages/gitbook/src/components/Header/Dropdown.tsx +++ b/packages/gitbook/src/components/Header/Dropdown.tsx @@ -91,8 +91,9 @@ export function DropdownChevron() { 'opacity-6', 'size-3', 'ms-1', - 'transition-transform', - 'group-hover/dropdown:rotate-180', + 'transition-all', + 'group-hover/dropdown:opacity-11', + 'group-focus-within/dropdown:rotate-180', )} /> ); diff --git a/packages/gitbook/src/components/Header/Header.tsx b/packages/gitbook/src/components/Header/Header.tsx index 82f15a06a..9bccae3e7 100644 --- a/packages/gitbook/src/components/Header/Header.tsx +++ b/packages/gitbook/src/components/Header/Header.tsx @@ -74,14 +74,23 @@ export function Header(props: { 'gap-4', 'lg:gap-8', 'flex', - 'h-16', 'items-center', 'justify-between', 'w-full', + 'py-3', + 'min-h-16', + 'sm:h-16', + isMultiVariants && 'page-no-toc:max-[400px]:flex-wrap', CONTAINER_STYLE, )} > -
+
- {!hasSiteSections && isMultiVariants ? ( -
- -
- ) : null}
+ {isMultiVariants && ( +
+ +
+ )} + {customization.header.links.length > 0 && ( {customization.header.links.map((link, index) => { diff --git a/packages/gitbook/src/components/Header/SpacesDropdown.tsx b/packages/gitbook/src/components/Header/SpacesDropdown.tsx index c539db215..1ba930a2a 100644 --- a/packages/gitbook/src/components/Header/SpacesDropdown.tsx +++ b/packages/gitbook/src/components/Header/SpacesDropdown.tsx @@ -10,6 +10,10 @@ export function SpacesDropdown(props: { space: Space; spaces: Space[]; className return ( (
- {space.title} + {space.title}
)} diff --git a/packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx b/packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx index f1b4b3736..22dd9d452 100644 --- a/packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx +++ b/packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx @@ -135,47 +135,31 @@ export async function SpaceLayout(props: { } innerHeader={ // displays the search button and/or the space dropdown in the ToC according to the header/variant settings. E.g if there is no header, the search button will be displayed in the ToC. - withVariants || !withTopHeader ? ( - <> - {!withTopHeader && ( -
- - - - {t( - getSpaceLanguage(customization), - customization.aiSearch.enabled - ? 'search_or_ask' - : 'search', - )} - - - -
- )} - {withVariants && ( -
- -
- )} - - ) : null + <> + {!withTopHeader && ( +
+ + + + {t( + getSpaceLanguage(customization), + customization.aiSearch.enabled + ? 'search_or_ask' + : 'search', + )} + + + +
+ )} + {withVariants && ( + + )} + } headerOffset={headerOffset} />