blob: 342e640c4ef68bfa04d705c846a809ed74951c4b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
"use client"
import { Button } from "@ui/components/button"
import { useRouter, usePathname } from "next/navigation"
import { cn } from "@repo/lib/utils"
export default function SettingsPageLayout({
children,
}: {
children: React.ReactNode
}) {
const router = useRouter()
const pathname = usePathname()
const navItems = [
{ label: "Profile", path: "/settings" },
{ label: "Integrations", path: "/settings/integrations" },
{ label: "Billing", path: "/settings/billing" },
{ label: "Support", path: "/settings/support" },
]
return (
<div className="flex-1 overflow-hidden max-w-screen-lg mx-auto mt-4">
<div className="flex flex-col items-center">
<div className="w-full max-w-2xl">
<nav className="flex gap-[2px] px-1 py-1 text-sm rounded-[8px] bg-muted-foreground/10 text-foreground max-w-fit">
{navItems.map((item) => {
const isActive = pathname === item.path
return (
<Button
key={item.path}
onClick={() => router.push(item.path)}
variant="settingsNav"
size="sm"
className={cn(
"transition-all duration-200",
isActive
? "opacity-100 bg-card"
: "opacity-60 hover:opacity-100 hover:bg-card ",
)}
>
{item.label}
</Button>
)
})}
</nav>
{children}
</div>
</div>
</div>
)
}
|