From 2e5d9418d4517b1beae4e556adef706d74bb16d3 Mon Sep 17 00:00:00 2001 From: Zeno Kapitein Date: Mon, 23 Jun 2025 16:41:39 +0200 Subject: [PATCH] New design --- .../src/components/Cookies/CookiesToast.tsx | 2 +- .../DocumentView/Tabs/DynamicTabs.tsx | 241 ++++++++++++------ 2 files changed, 158 insertions(+), 85 deletions(-) diff --git a/packages/gitbook/src/components/Cookies/CookiesToast.tsx b/packages/gitbook/src/components/Cookies/CookiesToast.tsx index 281e6ad91..f3cc52a44 100644 --- a/packages/gitbook/src/components/Cookies/CookiesToast.tsx +++ b/packages/gitbook/src/components/Cookies/CookiesToast.tsx @@ -43,7 +43,7 @@ export function CookiesToast(props: { privacyPolicy?: string }) { aria-describedby={describedById} className={tcls( 'fixed', - 'z-10', + 'z-50', 'bg-tint-base', 'rounded', 'straight-corners:rounded-none', diff --git a/packages/gitbook/src/components/DocumentView/Tabs/DynamicTabs.tsx b/packages/gitbook/src/components/DocumentView/Tabs/DynamicTabs.tsx index 0638e5ba1..0ce0ae704 100644 --- a/packages/gitbook/src/components/DocumentView/Tabs/DynamicTabs.tsx +++ b/packages/gitbook/src/components/DocumentView/Tabs/DynamicTabs.tsx @@ -84,8 +84,10 @@ export function DynamicTabs( ); }, [id, tabs, tabsState]); - const position: string = 'top'; // TODO: Get position from tab block options - const description = null; // TODO: Get description from tabs + const orientation: string = 'horizontal'; // TODO: Get orientation from tab block options + const position: string = 'start'; // TODO: Get position from tab block options + + const description = null; //'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'; // null; // TODO: Get description from tabs // To avoid issue with hydration, we only use the state from localStorage // once the component has been mounted. @@ -148,21 +150,16 @@ export function DynamicTabs( className={tcls( 'flex', 'flex-col', - position === 'left' && 'gap-4 md:flex-row', - position === 'right' && 'gap-4 md:flex-row-reverse', 'overflow-hidden', + 'pb-1', - style, + orientation === 'horizontal' && position === 'start' && 'flex-col', + orientation === 'vertical' && position === 'start' && 'md:flex-row', + orientation === 'vertical' && position === 'end' && 'md:flex-row-reverse', + + style // We need to inset the tabs container to make edge-to-edge scrolling work, since this container has overflow:hidden // Also important to put this after the `style` to override those. - '-mx-4', - 'px-4', - 'sm:-mx-6', - 'sm:px-6', - 'md:mx-auto', - 'md:px-0', - 'w-auto', - 'md:w-full' )} >
{tabs.map((tab) => ( - + > +
+ {tab.title} +
+ +
+ {description ? ( +

{description}

+ ) : null} + + ))} {tabs.map((tab, index) => ( @@ -271,14 +336,22 @@ export function DynamicTabs( aria-labelledby={getTabButtonId(tab.id)} className={tcls( 'p-4', - 'rounded-lg', - 'flex-1', + 'rounded-md', 'straight-corners:rounded-none', 'circular-corners:rounded-2xl', - 'grow', + 'z-10', + 'bg-tint-base', + position === 'start' && '!rounded-tl-none', + position === 'end' && '!rounded-tr-none', + // index === 0 && active.id === tab.id + // ? '!rounded-tl-none' + // : '[.peer:has(.tab:first-child:hover)~&]:rounded-tl-none', + 'transition-all', 'ring-1', 'ring-inset', 'ring-tint-subtle', + 'grow', + 'depth-subtle:shadow-sm', tab.id !== active.id ? 'hidden' : null )} >