Added mobile support

This commit is contained in:
2025-06-28 15:35:02 +02:00
parent 7bd43b8e3f
commit 75117b9248
2 changed files with 32 additions and 6 deletions

View File

@@ -0,0 +1,23 @@
"use client"
import { SidebarTrigger } from "@/components/ui/sidebar"
import { useIsMobile } from "@/hooks/use-mobile"
import { ReactNode } from "react"
export function SidebarClient({ children }: { children: ReactNode }) {
const isMobile = useIsMobile()
if (isMobile) {
return (
<div className="flex flex-col w-full">
<div className="p-2 border-b flex items-center gap-1">
<SidebarTrigger />
<span className="text-xl">Linker</span>
</div>
<div className="flex-1 flex">{children}</div>
</div>
)
}
return children
}

View File

@@ -1,6 +1,7 @@
import { SidebarProvider } from "@/components/ui/sidebar" import { SidebarProvider } from "@/components/ui/sidebar"
import { ReactNode } from "react" import { ReactNode } from "react"
import { DashboardSidebar } from "./_components/sidebar" import { DashboardSidebar } from "./_components/sidebar"
import { SidebarClient } from "./_components/sidebar-client"
export default function DashboardLayout({ export default function DashboardLayout({
children children
@@ -9,12 +10,14 @@ export default function DashboardLayout({
}) { }) {
return ( return (
<SidebarProvider> <SidebarProvider>
<SidebarClient>
<div className="min-h-screen flex w-full"> <div className="min-h-screen flex w-full">
<DashboardSidebar /> <DashboardSidebar />
<main className="flex-1 overflow-auto"> <main className="flex-1 overflow-auto">
{children} {children}
</main> </main>
</div> </div>
</SidebarClient>
</SidebarProvider> </SidebarProvider>
) )
} }