web/app/components/repo-tabs.tsxblame
View source
9e346cc1import Link from "next/link";
9e346cc2
9e346cc3interface RepoTabsProps {
9e346cc4 owner: string;
9e346cc5 repo: string;
ab61b9d6 active: "code" | "diffs" | "pipelines" | "commits" | "settings";
9e346cc7}
9e346cc8
9e346cc9const tabs = [
9e346cc10 { key: "code", label: "Code", href: (o: string, r: string) => `/${o}/${r}` },
9e346cc11 {
d12933e12 key: "diffs",
d12933e13 label: "Diffs",
d12933e14 href: (o: string, r: string) => `/${o}/${r}/diffs`,
9e346cc15 },
80fafdf16 {
80fafdf17 key: "pipelines",
087adca18 label: "Builds",
9d879c019 href: (o: string, r: string) => `/${o}/${r}/builds`,
80fafdf20 },
9e346cc21 {
9e346cc22 key: "commits",
9e346cc23 label: "Commits",
530592e24 href: (o: string, r: string) => `/${o}/${r}/commits`,
9e346cc25 },
ab61b9d26 {
ab61b9d27 key: "settings",
ab61b9d28 label: "Settings",
ab61b9d29 href: (o: string, r: string) => `/${o}/${r}/settings`,
ab61b9d30 },
9e346cc31] as const;
9e346cc32
530592e33export function RepoTabs({ owner, repo, active }: RepoTabsProps) {
9e346cc34 return (
9e346cc35 <div
9e346cc36 className="flex gap-0 text-sm mb-6"
9e346cc37 style={{ borderBottom: "1px solid var(--border)" }}
9e346cc38 >
9e346cc39 {tabs.map((tab) => {
9e346cc40 const isActive = tab.key === active;
9e346cc41 return (
9e346cc42 <Link
9e346cc43 key={tab.key}
530592e44 href={tab.href(owner, repo)}
9e346cc45 className="px-3 py-2 -mb-px transition-colors"
9e346cc46 style={{
9e346cc47 color: isActive ? "var(--text-primary)" : "var(--text-muted)",
9e346cc48 borderBottom: isActive
9e346cc49 ? "2px solid var(--accent)"
9e346cc50 : "2px solid transparent",
9e346cc51 }}
9e346cc52 >
9e346cc53 {tab.label}
9e346cc54 </Link>
9e346cc55 );
9e346cc56 })}
9e346cc57 </div>
9e346cc58 );
9e346cc59}