mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
fix(studio): table editor sidebar toggle on mobile (#41894)
fix: table editor sidebar toggle on mobile
This commit is contained in:
1 parent
52587d49e9
commit
e284e5ddcd
1 file changed
+12
-2
@@ -2,9 +2,19 @@ import { PanelLeftClose, PanelLeftOpen } from 'lucide-react'
|
||||
|
||||
import { useAppStateSnapshot } from 'state/app-state'
|
||||
import { cn, Tooltip, TooltipContent, TooltipTrigger } from 'ui'
|
||||
import { useBreakpoint } from 'common'
|
||||
|
||||
export function CollapseButton({ hideTabs }: { hideTabs: boolean }) {
|
||||
const { showSidebar, setShowSidebar } = useAppStateSnapshot()
|
||||
const { showSidebar, setShowSidebar, mobileMenuOpen, setMobileMenuOpen } = useAppStateSnapshot()
|
||||
const isMobile = useBreakpoint('md')
|
||||
|
||||
const handleToggle = () => {
|
||||
if (isMobile) {
|
||||
setMobileMenuOpen(!mobileMenuOpen)
|
||||
} else {
|
||||
setShowSidebar(!showSidebar)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Tooltip>
|
||||
@@ -14,7 +24,7 @@ export function CollapseButton({ hideTabs }: { hideTabs: boolean }) {
|
||||
'hidden md:flex items-center justify-center w-10 h-10 hover:bg-surface-100 shrink-0',
|
||||
!hideTabs && 'border-b border-b-default'
|
||||
)}
|
||||
onClick={() => setShowSidebar(!showSidebar)}
|
||||
onClick={handleToggle}
|
||||
>
|
||||
{showSidebar ? (
|
||||
<PanelLeftClose
|
||||
|
||||
Reference in new issue
Block a user