|
| 1 | +import { |
| 2 | + Sidebar, |
| 3 | + SidebarContent, |
| 4 | + SidebarGroup, |
| 5 | + SidebarGroupContent, |
| 6 | + SidebarHeader, |
| 7 | + SidebarInput, |
| 8 | + SidebarMenu, |
| 9 | + SidebarMenuButton, |
| 10 | + SidebarMenuItem, |
| 11 | + SidebarProvider, |
| 12 | +} from "@/components/core/sidebar"; |
| 13 | + |
| 14 | +import { |
| 15 | + AppStoreIcon, |
| 16 | + CogIcon, |
| 17 | + EnvironmentsIcon, |
| 18 | + PeopleIcon, |
| 19 | +} from "@/components/icons"; |
| 20 | +import { cn } from "@/lib/utils"; |
| 21 | +import { |
| 22 | + IconBellRingingFilled, |
| 23 | + IconHourglassHigh, |
| 24 | + IconMoonFilled, |
| 25 | +} from "@tabler/icons-react"; |
| 26 | +import { Window } from "@/components/core/window"; |
| 27 | +import { defaultWindowProps } from "../constants"; |
| 28 | + |
| 29 | +const section_1 = [ |
| 30 | + { |
| 31 | + title: "General", |
| 32 | + icon: CogIcon, |
| 33 | + gradient: "from-gray-400 to-gray-600", |
| 34 | + isActive: true, |
| 35 | + }, |
| 36 | + { |
| 37 | + title: "Apps", |
| 38 | + icon: AppStoreIcon, |
| 39 | + gradient: "from-sky-500 to-blue-700", |
| 40 | + }, |
| 41 | + { |
| 42 | + title: "People", |
| 43 | + icon: PeopleIcon, |
| 44 | + gradient: "from-green-400 to-green-600", |
| 45 | + }, |
| 46 | + { |
| 47 | + title: "Environments", |
| 48 | + icon: EnvironmentsIcon, |
| 49 | + gradient: "from-indigo-400 to-indigo-800", |
| 50 | + }, |
| 51 | +]; |
| 52 | + |
| 53 | +const section_2 = [ |
| 54 | + { |
| 55 | + title: "Notifications", |
| 56 | + icon: IconBellRingingFilled, |
| 57 | + gradient: "from-rose-400 to-red-600", |
| 58 | + }, |
| 59 | + { |
| 60 | + title: "Focus", |
| 61 | + href: "#", |
| 62 | + icon: IconMoonFilled, |
| 63 | + gradient: "from-indigo-400 to-indigo-800", |
| 64 | + }, |
| 65 | + { |
| 66 | + title: "Screen Time", |
| 67 | + href: "#", |
| 68 | + icon: IconHourglassHigh, |
| 69 | + gradient: "from-indigo-400 to-indigo-800", |
| 70 | + }, |
| 71 | +]; |
| 72 | + |
| 73 | +export default function SettingsLayout({ |
| 74 | + children, |
| 75 | +}: { |
| 76 | + children: React.ReactNode; |
| 77 | +}) { |
| 78 | + return ( |
| 79 | + <Window {...defaultWindowProps}> |
| 80 | + <SidebarProvider> |
| 81 | + <Sidebar> |
| 82 | + <SidebarHeader> |
| 83 | + <SidebarInput placeholder="Search" /> |
| 84 | + </SidebarHeader> |
| 85 | + <SidebarContent> |
| 86 | + <SidebarGroup> |
| 87 | + <SidebarGroupContent> |
| 88 | + <SidebarMenu> |
| 89 | + {section_1.map((item) => ( |
| 90 | + <SidebarMenuItem key={item.title}> |
| 91 | + <SidebarMenuButton |
| 92 | + className="gap-4 [&_[data-slot='icon']]:opacity-75" |
| 93 | + isActive={item.isActive} |
| 94 | + > |
| 95 | + <item.icon data-slot="icon" /> |
| 96 | + <span |
| 97 | + className={cn( |
| 98 | + "absolute left-3.5 top-2 z-[-1] size-8 rounded-full", |
| 99 | + "bg-gradient-to-b", |
| 100 | + item.gradient, |
| 101 | + )} |
| 102 | + /> |
| 103 | + <span>{item.title}</span> |
| 104 | + </SidebarMenuButton> |
| 105 | + </SidebarMenuItem> |
| 106 | + ))} |
| 107 | + </SidebarMenu> |
| 108 | + </SidebarGroupContent> |
| 109 | + </SidebarGroup> |
| 110 | + <SidebarGroup className="pt-0"> |
| 111 | + <SidebarGroupContent> |
| 112 | + <SidebarMenu> |
| 113 | + {section_2.map((item) => ( |
| 114 | + <SidebarMenuItem key={item.title}> |
| 115 | + <SidebarMenuButton className="gap-4 [&_[data-slot='icon']]:opacity-75"> |
| 116 | + <item.icon data-slot="icon" /> |
| 117 | + <span |
| 118 | + className={cn( |
| 119 | + "absolute left-3.5 top-2 z-[-1] size-8 rounded-full", |
| 120 | + "bg-gradient-to-b", |
| 121 | + item.gradient, |
| 122 | + )} |
| 123 | + /> |
| 124 | + <span>{item.title}</span> |
| 125 | + </SidebarMenuButton> |
| 126 | + </SidebarMenuItem> |
| 127 | + ))} |
| 128 | + </SidebarMenu> |
| 129 | + </SidebarGroupContent> |
| 130 | + </SidebarGroup> |
| 131 | + </SidebarContent> |
| 132 | + </Sidebar> |
| 133 | + <main className="relative w-full">{children}</main> |
| 134 | + </SidebarProvider> |
| 135 | + </Window> |
| 136 | + ); |
| 137 | +} |
0 commit comments