mirror of
https://github.com/supabase/supabase.git
synced 2026-10-16 06:39:09 +03:00
* SheetProvider in studio * mobile global nav * view sub navigation * fix ProjectLayout conditional * Account mobile layout * width * hide * layout * overflow * responsive button * overflow * fix mobile nav if IS_PLATFORM * refactor * hide if no content * show command menu item on mobile * ui-patterns sheet provider * use client * show if productMenu * show if productMenu * drag to close * drag to close * 16px input fontsize on inputs to avoid zoom on mobile * offscreen test element * offscreen test element * offscreen test element * update test * update test * update test * pb * test? * test * test * test * spec-click-target * remove console * remove unused import * add dependency to sheet content * close sheet on router.asPath change * remove provider and use simple Sheet * update sidebar mobile * align labels * avoid input zoom on mobile * remove yo
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
'use client'
|
|
|
|
import { useRouter } from 'next/router'
|
|
import { useEffect } from 'react'
|
|
import { ErrorBoundary } from 'react-error-boundary'
|
|
import { useWindowSize } from 'react-use'
|
|
import { CommandEmpty_Shadcn_, Sheet, SheetContent } from 'ui'
|
|
import { cn } from 'ui/src/lib/utils'
|
|
|
|
const MobileSheetNav: React.FC<{
|
|
children: React.ReactNode
|
|
open?: boolean
|
|
onOpenChange(open: boolean): void
|
|
}> = ({ children, open = false, onOpenChange }) => {
|
|
const router = useRouter()
|
|
const { width } = useWindowSize()
|
|
|
|
useEffect(() => {
|
|
onOpenChange(false)
|
|
}, [router?.asPath])
|
|
|
|
useEffect(() => {
|
|
onOpenChange(false)
|
|
}, [width])
|
|
|
|
return (
|
|
<Sheet open={open} onOpenChange={onOpenChange}>
|
|
<SheetContent
|
|
id="mobile-sheet-content"
|
|
showClose={false}
|
|
size="full"
|
|
side="bottom"
|
|
className={cn(
|
|
'rounded-t-lg overflow-hidden overflow-y-scroll',
|
|
'h-[85dvh] md:max-h-[500px] py-2'
|
|
)}
|
|
>
|
|
<ErrorBoundary FallbackComponent={() => <CommandEmpty_Shadcn_ />}>{children}</ErrorBoundary>
|
|
</SheetContent>
|
|
</Sheet>
|
|
)
|
|
}
|
|
|
|
export default MobileSheetNav
|