diff --git a/packages/gitbook/src/components/Header/HeaderMobileMenuButton.tsx b/packages/gitbook/src/components/Header/HeaderMobileMenuButton.tsx index 38834f048..3839043a6 100644 --- a/packages/gitbook/src/components/Header/HeaderMobileMenuButton.tsx +++ b/packages/gitbook/src/components/Header/HeaderMobileMenuButton.tsx @@ -3,7 +3,7 @@ import { Icon } from '@gitbook/icons'; import { useEffect } from 'react'; -import { useMobileMenuSheet } from '@/components/Header/mobile-menu/useMobileMenuSheet'; +import { useMobileMenuSheet } from '@/components/MobileMenu/useMobileMenuSheet'; import { tString, useLanguage } from '@/intl/client'; import { tcls } from '@/lib/tailwind'; import { usePathname } from 'next/navigation'; diff --git a/packages/gitbook/src/components/Header/mobile-menu/MobileMenuSheet.tsx b/packages/gitbook/src/components/MobileMenu/MobileMenuSheet.tsx similarity index 95% rename from packages/gitbook/src/components/Header/mobile-menu/MobileMenuSheet.tsx rename to packages/gitbook/src/components/MobileMenu/MobileMenuSheet.tsx index 5ccf148a3..ab416a056 100644 --- a/packages/gitbook/src/components/Header/mobile-menu/MobileMenuSheet.tsx +++ b/packages/gitbook/src/components/MobileMenu/MobileMenuSheet.tsx @@ -6,7 +6,7 @@ import { SheetDescription, SheetHeader, SheetTitle, -} from '@/components/utils/Sheet'; +} from '@/components/primitives/Sheet'; import { useMobileMenuSheet } from './useMobileMenuSheet'; export function MobileMenuSheet(props: { children: React.ReactNode }) { diff --git a/packages/gitbook/src/components/MobileMenu/index.ts b/packages/gitbook/src/components/MobileMenu/index.ts new file mode 100644 index 000000000..63a6b585b --- /dev/null +++ b/packages/gitbook/src/components/MobileMenu/index.ts @@ -0,0 +1,2 @@ +export * from './MobileMenuSheet'; +export * from './useMobileMenuSheet'; diff --git a/packages/gitbook/src/components/Header/mobile-menu/useMobileMenuSheet.ts b/packages/gitbook/src/components/MobileMenu/useMobileMenuSheet.ts similarity index 100% rename from packages/gitbook/src/components/Header/mobile-menu/useMobileMenuSheet.ts rename to packages/gitbook/src/components/MobileMenu/useMobileMenuSheet.ts diff --git a/packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx b/packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx index 97b536cb4..556cb32dc 100644 --- a/packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx +++ b/packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx @@ -11,7 +11,7 @@ import { getSpaceLanguage } from '@/intl/server'; import { t } from '@/intl/translate'; import { tcls } from '@/lib/tailwind'; -import { MobileMenuSheet } from '@/components/Header/mobile-menu/MobileMenuSheet'; +import { MobileMenuSheet } from '@/components/MobileMenu'; import { TOCScrollContent } from '@/components/TableOfContents/TOCScrollContent'; import type { VisitorAuthClaims } from '@/lib/adaptive'; import { GITBOOK_API_PUBLIC_URL, GITBOOK_APP_URL } from '@v2/lib/env'; diff --git a/packages/gitbook/src/components/utils/Sheet.tsx b/packages/gitbook/src/components/primitives/Sheet.tsx similarity index 71% rename from packages/gitbook/src/components/utils/Sheet.tsx rename to packages/gitbook/src/components/primitives/Sheet.tsx index 755d453b3..27c64aa86 100644 --- a/packages/gitbook/src/components/utils/Sheet.tsx +++ b/packages/gitbook/src/components/primitives/Sheet.tsx @@ -6,22 +6,53 @@ 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 @@ -30,7 +61,7 @@ function SheetOverlay({ ) { return (
); } +/** + * Title component for the sheet dialog. + * Renders the main heading of the sheet with consistent styling. + */ export function SheetTitle({ className, ...props @@ -132,6 +177,10 @@ export function SheetTitle({ ); } +/** + * Description component for the sheet dialog. + * Renders supplementary text or description with consistent styling. + */ export function SheetDescription({ className, ...props