|
| 1 | +<script lang="ts"> |
| 2 | + import type { Snippet } from "svelte"; |
| 3 | + import Settings from "lucide-svelte/icons/settings"; |
| 4 | + import Users from "lucide-svelte/icons/users"; |
| 5 | + import Snowflake from "lucide-svelte/icons/snowflake"; |
| 6 | + import ClipboardCheck from "lucide-svelte/icons/clipboard-check"; |
| 7 | + import { cn } from "$lib/utils/shadcn-helper"; |
| 8 | + import Separator from "$lib/components/primitives/separator/separator.svelte"; |
| 9 | +
|
| 10 | + type TabValue = (typeof tabs)[number]["value"]; |
| 11 | + interface Props { |
| 12 | + projectId: number; |
| 13 | + selectedTab: TabValue; |
| 14 | + children?: Snippet | undefined; |
| 15 | + } |
| 16 | +
|
| 17 | + let { projectId, selectedTab, children = undefined }: Props = $props(); |
| 18 | +
|
| 19 | + const tabs = [ |
| 20 | + { |
| 21 | + icon: Settings, |
| 22 | + label: "General", |
| 23 | + value: "general", |
| 24 | + href: `/project/${projectId}/settings/general`, |
| 25 | + }, |
| 26 | + { |
| 27 | + icon: Users, |
| 28 | + label: "Members", |
| 29 | + value: "members", |
| 30 | + href: `/project/${projectId}/settings/members`, |
| 31 | + }, |
| 32 | + { icon: Snowflake, label: "SLR", value: "slr", href: `/project/${projectId}/settings/slr` }, |
| 33 | + { |
| 34 | + icon: ClipboardCheck, |
| 35 | + label: "Review", |
| 36 | + value: "review", |
| 37 | + href: `/project/${projectId}/settings/review`, |
| 38 | + }, |
| 39 | + ] as const; |
| 40 | +</script> |
| 41 | + |
| 42 | +<main class="flex flex-row w-full h-full px-[3.75rem] py-2.5 gap-4 overflow-hidden"> |
| 43 | + <div class="flex flex-col w-full min-w-[9rem] max-w-[20%] h-full px-1.5 py-2.5 gap-2.5"> |
| 44 | + {#each tabs as tab} |
| 45 | + <a |
| 46 | + class={cn( |
| 47 | + "flex flex-row w-full items-center h-12 px-3 gap-3", |
| 48 | + tab.value === selectedTab ? "bg-slate-200 rounded-lg" : "", |
| 49 | + )} |
| 50 | + href={tab.href} |
| 51 | + > |
| 52 | + <tab.icon class="size-4" /> |
| 53 | + <span>{tab.label}</span> |
| 54 | + </a> |
| 55 | + {/each} |
| 56 | + </div> |
| 57 | + <Separator orientation="vertical" /> |
| 58 | + <div class="flex flex-col w-full h-full p-2.5 gap-3 overflow-y-auto"> |
| 59 | + {@render children?.()} |
| 60 | + </div> |
| 61 | +</main> |
0 commit comments