Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Position the variant picker in the ToC #2632

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions packages/gitbook/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,6 @@ export function Header(props: {
)}
/>
<HeaderLogo site={site} space={space} customization={customization} />
{!hasSiteSections && isMultiVariants ? (
<div className="z-20 shrink hidden sm:block">
<SpacesDropdown space={space} spaces={spaces} />
</div>
) : null}
</div>

{customization.header.links.length > 0 && (
Expand Down
14 changes: 9 additions & 5 deletions packages/gitbook/src/components/Header/SpacesDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ export function SpacesDropdown(props: { space: Space; spaces: Space[]; className
'flex',
'flex-row',
'items-center',
'rounded-2xl',
'straight-corners:rounded-none',
'gap-2',

'straight-corners:rounded-none',
'rounded-2xl',
'border-1',
'shadow-[0_0_2px_rgba(0,0,0,0.12),0_1px_2px_rgba(0,0,0,0.12)]',
'dark:shadow-[0_1px_2px_rgba(0,0,0,0.5),0_0_1px_rgba(0,0,0,0.3)]',
'hover:cursor-pointer',
'bg-dark/1',
'dark:bg-light/1',
'bg-light',
'dark:bg-dark-3',

'text-sm',
'text-dark-4',
Expand All @@ -36,7 +40,7 @@ export function SpacesDropdown(props: { space: Space; spaces: Space[]; className
'dark:contrast-more:bg-dark',

'px-3',
'py-1',
'py-1.5',
className,
)}
>
Expand Down
13 changes: 5 additions & 8 deletions packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ export function SpaceLayout(props: {

const withSections = Boolean(sections && sections.list.length > 0);
const withVariants = Boolean(site && spaces.length > 1);
const headerOffset = { sectionsHeader: withSections, topHeader: withTopHeader };
const headerOffset = {
sectionsHeader: withSections,
topHeader: withTopHeader,
};

return (
<>
Expand Down Expand Up @@ -106,13 +109,7 @@ export function SpaceLayout(props: {
)
}
innerHeader={
withVariants && (
<SpacesDropdown
className={withTopHeader && !sections ? 'sm:hidden' : undefined}
space={space}
spaces={spaces}
/>
)
withVariants && <SpacesDropdown space={space} spaces={spaces} />
}
headerOffset={headerOffset}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export function TableOfContents(props: {
<TOCScrollContainer
className={tcls(
withHeaderOffset ? 'pt-4' : ['pt-4', 'lg:pt-0'],
'gap-6',
'hidden',
'lg:flex',
'flex-grow',
Expand All @@ -93,7 +94,7 @@ export function TableOfContents(props: {
customization.trademark.enabled ? 'lg:pb-20' : 'lg:pb-4',
)}
>
{innerHeader && <div className={tcls('ms-5', 'mb-4')}>{innerHeader}</div>}
{innerHeader && <div className={tcls('ms-5', 'pt-3')}>{innerHeader}</div>}
<PagesList
rootPages={pages}
pages={pages}
Expand Down
Loading