diff --git a/packages/gitbook/src/components/DocumentView/Tabs/DynamicTabs.tsx b/packages/gitbook/src/components/DocumentView/Tabs/DynamicTabs.tsx index e4465b303..8c6966975 100644 --- a/packages/gitbook/src/components/DocumentView/Tabs/DynamicTabs.tsx +++ b/packages/gitbook/src/components/DocumentView/Tabs/DynamicTabs.tsx @@ -84,6 +84,8 @@ export function DynamicTabs( ); }, [id, tabs, tabsState]); + const position: string = 'top'; + // To avoid issue with hydration, we only use the state from localStorage // once the component has been mounted. // Otherwise because of the streaming/suspense approach, tabs can be first-rendered at different time @@ -143,13 +145,14 @@ export function DynamicTabs( return (
{tabs.map((tab) => ( @@ -174,49 +180,41 @@ export function DynamicTabs( hashLinkButtonWrapperStyles, 'flex', 'items-center', - 'gap-3.5', + 'relative', + position === 'left' && 'pr-1.5', + position === 'right' && 'pl-1.5', + position === 'top' && 'max-w-full overflow-hidden pb-1.5', + 'min-w-16', //prev from active-tab - '[&:has(+_.active-tab)]:rounded-br-md', + // '[&:has(+_.active-tab)]:rounded-br-md', //next from active-tab - '[.active-tab_+_&]:rounded-bl-md', + // '[.active-tab_+_&]:rounded-bl-md', //next from active-tab - '[.active-tab_+_:after]:rounded-br-md', + // '[.active-tab_+_:after]:rounded-br-md', - 'after:transition-colors', - 'after:border-r', - 'after:absolute', - 'after:left-[unset]', - 'after:right-0', - 'after:border-tint', - 'after:top-[15%]', - 'after:h-[70%]', - 'after:w-[1px]', + // 'after:transition-colors', + // 'after:border-r', + // 'after:absolute', + // 'after:left-[unset]', + // 'after:right-0', + // 'after:border-tint', + // 'after:top-[15%]', + // 'after:h-[70%]', + // 'after:w-[1px]', - 'px-3.5', - 'py-2', - - 'last:after:border-transparent', + // 'last:after:border-transparent', 'text-tint', - 'bg-tint-12/1', - 'hover:text-tint-strong', - 'max-w-full', - 'truncate', + // 'bg-tint-subtle', + // 'bg-tint-12/1', + // 'hover:text-tint-strong', + 'text-sm', + 'font-medium', - active.id === tab.id - ? [ - 'shrink-0', - 'active-tab', - 'text-tint-strong', - 'bg-transparent', - 'after:[&.active-tab]:border-transparent', - 'after:[:has(+_&.active-tab)]:border-transparent', - 'after:[:has(&_+)]:border-transparent', - ] - : null + active.id === tab.id ? 'active-tab text-primary-subtle' : '' )} > - + {active.id === tab.id ? ( +
+ ) : null}
))}
@@ -255,7 +271,17 @@ export function DynamicTabs( role="tabpanel" id={getTabPanelId(tab.id)} aria-labelledby={getTabButtonId(tab.id)} - className={tcls('p-4', tab.id !== active.id ? 'hidden' : null)} + className={tcls( + 'p-4', + 'rounded-lg', + 'straight-corners:rounded-none', + 'circular-corners:rounded-2xl', + 'grow', + 'ring-1', + 'ring-inset', + 'ring-tint-subtle', + tab.id !== active.id ? 'hidden' : null + )} > {tabsBody[index]}