Update root sidebar header and actions

This commit is contained in:
MOH
2026-03-07 18:37:40 +01:00
parent 4f983f20b5
commit 02891ec45b
3 changed files with 29 additions and 33 deletions
+5 -3
View File
@@ -18,6 +18,7 @@ type DashboardLayoutProps = {
description: string;
icon?: LucideIcon;
items: RootNavItem[];
sidebarTop?: ReactNode;
sidebarFooter?: ReactNode;
headerActions?: ReactNode;
children: ReactNode;
@@ -28,6 +29,7 @@ export function DashboardLayout({
description,
icon: Icon,
items,
sidebarTop,
sidebarFooter,
headerActions,
children,
@@ -35,8 +37,8 @@ export function DashboardLayout({
return (
<div className="min-h-screen bg-muted/30">
<div className="grid min-h-screen lg:grid-cols-[280px_minmax(0,1fr)]">
<aside className="hidden border-r border-border/70 bg-sidebar/60 lg:block">
<DashboardSidebar items={items} footer={sidebarFooter} />
<aside className="hidden border-r border-border/70 bg-sidebar/60 lg:sticky lg:top-0 lg:block lg:h-screen">
<DashboardSidebar items={items} top={sidebarTop} footer={sidebarFooter} />
</aside>
<div className="flex min-w-0 flex-1 flex-col">
@@ -52,7 +54,7 @@ export function DashboardLayout({
<SheetTitle>{title}</SheetTitle>
<SheetDescription>{description}</SheetDescription>
</SheetHeader>
<DashboardSidebar items={items} footer={sidebarFooter} />
<DashboardSidebar items={items} top={sidebarTop} footer={sidebarFooter} />
</SheetContent>
</Sheet>
+6 -16
View File
@@ -1,9 +1,8 @@
import type { ReactNode } from "react";
import Link from "next/link";
import Image from "next/image";
import type { LucideIcon } from "lucide-react";
import { ShieldCheck } from "lucide-react";
import { Badge } from "@/components/ui/badge";
import { Separator } from "@/components/ui/separator";
import { cn } from "@/lib/utils";
@@ -17,10 +16,11 @@ type DashboardSidebarItem = {
type DashboardSidebarProps = {
items: DashboardSidebarItem[];
top?: ReactNode;
footer?: ReactNode;
};
export function DashboardSidebar({ items, footer }: DashboardSidebarProps) {
export function DashboardSidebar({ items, top, footer }: DashboardSidebarProps) {
function renderItem(item: DashboardSidebarItem, nested = false) {
const Icon = item.icon;
@@ -47,8 +47,8 @@ export function DashboardSidebar({ items, footer }: DashboardSidebarProps) {
return (
<div className="flex h-full flex-col bg-sidebar/40">
<div className="flex items-center gap-3 px-4 py-5">
<div className="rounded-xl bg-primary/10 p-2 text-primary">
<ShieldCheck className="h-5 w-5" />
<div className="overflow-hidden rounded-xl border border-border/70 bg-background shadow-sm">
<Image src="/favicon.ico" alt="Mohs Admin" width={36} height={36} className="h-9 w-9" />
</div>
<div className="min-w-0">
<p className="truncate text-sm font-semibold text-foreground">Mohs Admin</p>
@@ -56,17 +56,7 @@ export function DashboardSidebar({ items, footer }: DashboardSidebarProps) {
</div>
</div>
<div className="px-4">
<div className="rounded-xl border border-border/70 bg-background/80 p-4">
<div className="flex items-center justify-between gap-3">
<div>
<p className="text-sm font-medium text-foreground">Private panel</p>
<p className="mt-1 text-xs text-muted-foreground">Single owner access</p>
</div>
<Badge variant="outline">Private</Badge>
</div>
</div>
</div>
{top ? <div className="px-4">{top}</div> : null}
<Separator className="my-4" />