diff --git a/packages/gitbook/src/components/Header/HeaderMobileMenuButton.tsx b/packages/gitbook/src/components/Header/HeaderMobileMenuButton.tsx index 0d99118cf..99609a46d 100644 --- a/packages/gitbook/src/components/Header/HeaderMobileMenuButton.tsx +++ b/packages/gitbook/src/components/Header/HeaderMobileMenuButton.tsx @@ -1,12 +1,10 @@ 'use client'; import { Icon } from '@gitbook/icons'; -import { useEffect } from 'react'; import { useMobileMenuSheet } from '@/components/MobileMenu/useMobileMenuSheet'; import { tString, useLanguage } from '@/intl/client'; import { tcls } from '@/lib/tailwind'; -import { usePathname } from 'next/navigation'; /** * Button to show/hide the table of content on mobile. @@ -15,18 +13,12 @@ export function HeaderMobileMenuButton( props: Partial> ) { const language = useLanguage(); - const pathname = usePathname(); const { open, setOpen } = useMobileMenuSheet(); const toggleNavigation = () => { setOpen(!open); }; - // biome-ignore lint/correctness/useExhaustiveDependencies: Close the navigation when navigating to a page - useEffect(() => { - setOpen(false); - }, [pathname]); - return ( + ) : null} + {children} + ); } diff --git a/packages/gitbook/src/components/TableOfContents/Trademark.tsx b/packages/gitbook/src/components/TableOfContents/Trademark.tsx index 1380431b3..7b66619ce 100644 --- a/packages/gitbook/src/components/TableOfContents/Trademark.tsx +++ b/packages/gitbook/src/components/TableOfContents/Trademark.tsx @@ -26,7 +26,8 @@ export function Trademark(props: { 'left-2', 'right-2', - 'bottom-0', + 'bottom-2', + 'lg:bottom-0', 'lg:left-0', 'pt-2', diff --git a/packages/gitbook/src/components/primitives/Sheet.tsx b/packages/gitbook/src/components/primitives/Sheet.tsx deleted file mode 100644 index 33d819244..000000000 --- a/packages/gitbook/src/components/primitives/Sheet.tsx +++ /dev/null @@ -1,198 +0,0 @@ -'use client'; - -import * as SheetPrimitive from '@radix-ui/react-dialog'; -import type * as React from 'react'; - -import { Button } from '@/components/primitives'; -import { tcls } from '@/lib/tailwind'; - -/** - * Root component for the Sheet dialog. - * Wraps the Radix UI Dialog.Root component and provides the context for the sheet dialog. - * - * @example - * - * Open - * - * - * Title - * Description - * - * - * - */ -export function Sheet({ ...props }: React.ComponentProps) { - return ; -} - -/** - * Trigger component that opens the sheet dialog. - * Typically used as a button or other interactive element to open the sheet. - */ -export function SheetTrigger({ ...props }: React.ComponentProps) { - return ; -} - -/** - * Close component that closes the sheet dialog. - * Can be used to create custom close buttons or triggers. - */ -export function SheetClose({ ...props }: React.ComponentProps) { - return ; -} - -/** - * Portal component that renders the sheet content outside the DOM hierarchy. - * Ensures proper stacking context and accessibility. - */ -export function SheetPortal({ ...props }: React.ComponentProps) { - return ; -} - -/** - * Overlay component that creates a semi-transparent backdrop behind the sheet. - * Includes blur effect and animation states for opening/closing. - */ -function SheetOverlay({ - className, - ...props -}: React.ComponentProps) { - return ( - - ); -} - -interface SheetContentProps extends React.ComponentProps { - /** - * The class name for the overlay component. - */ - overlayClassName?: string; - /** - * The side the sheet slides in from. - * @default 'left' - */ - side?: 'right' | 'left'; -} - -/** - * Main content component for the sheet dialog. - * Handles positioning, animations, and styling of the sheet content. - */ -export function SheetContent(props: SheetContentProps) { - const { overlayClassName, side = 'left', className, children, ...rest } = props; - - return ( - - - - {children} - - - - - - - ); -} - -/** - * Header component for the sheet dialog. - * Provides consistent padding and layout for the sheet header area. - */ -export function SheetHeader({ className, ...props }: React.ComponentProps<'div'>) { - return ( -
- ); -} - -/** - * Title component for the sheet dialog. - * Renders the main heading of the sheet with consistent styling. - */ -export function SheetTitle({ - className, - ...props -}: React.ComponentProps) { - return ( - - ); -} - -/** - * Description component for the sheet dialog. - * Renders supplementary text or description with consistent styling. - */ -export function SheetDescription({ - className, - ...props -}: React.ComponentProps) { - return ( - - ); -}