mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-29 01:59:07 +02:00
* desktop UI light mode * Theme review fixes plus macOS window outline fix * Windows runtime chrome re-theming plus apply serialization * Windows chrome threading and theme event ordering fixes * Darken toggle and setting sidebar text * resolve theme appearance, apply on UI thread * read theme once per window * Re-assert Windows dark opt-in after SetTheme * split app-wide GTK theming from per-window chrome * Update Wails dependency and checksums * KDE tray icon panel fix * Five review fixes: theme ordering, cgo dedup, KDE panel resolution * Path guard hardening, toggle contrast, windows comment * non-vacuous escape tests * Default view edits * Polish settings nav, controls, borders, and disc * Profiles settings boarder, modals, and buttons * Additional edits based on feedback * Switch colors away from slight blue hue * Update missing lang * Fix vertical tab active view
101 lines
3.4 KiB
TypeScript
101 lines
3.4 KiB
TypeScript
import { type ComponentType, type ReactNode, forwardRef } from "react";
|
|
import * as Tabs from "@radix-ui/react-tabs";
|
|
import { type LucideProps } from "lucide-react";
|
|
import { cn } from "@/lib/cn";
|
|
import { useFocusVisible } from "@/hooks/useFocusVisible";
|
|
|
|
const Root = forwardRef<HTMLDivElement, Omit<Tabs.TabsProps, "orientation">>(
|
|
function VerticalTabsRoot({ className, ...props }, ref) {
|
|
return (
|
|
<Tabs.Root
|
|
ref={ref}
|
|
orientation={"vertical"}
|
|
className={cn("flex min-h-0 flex-1", className)}
|
|
{...props}
|
|
/>
|
|
);
|
|
},
|
|
);
|
|
|
|
const List = forwardRef<HTMLDivElement, Tabs.TabsListProps>(function VerticalTabsList(
|
|
{ className, ...props },
|
|
ref,
|
|
) {
|
|
return (
|
|
<Tabs.List
|
|
ref={ref}
|
|
className={cn("flex w-full flex-col gap-1 p-5 pr-0", className)}
|
|
{...props}
|
|
/>
|
|
);
|
|
});
|
|
|
|
type TriggerProps = Tabs.TabsTriggerProps & {
|
|
icon: ComponentType<LucideProps>;
|
|
title: string;
|
|
iconSize?: number;
|
|
adornment?: ReactNode;
|
|
};
|
|
|
|
const Trigger = forwardRef<HTMLButtonElement, TriggerProps>(function VerticalTabsTrigger(
|
|
{ icon: Icon, title, iconSize = 16, adornment, className, ...props },
|
|
ref,
|
|
) {
|
|
const isFocusVisible = useFocusVisible();
|
|
return (
|
|
<Tabs.Trigger
|
|
ref={ref}
|
|
className={cn(
|
|
"group flex w-full cursor-default items-center gap-3 rounded-md border border-transparent px-2 py-2.5 text-left outline-none dark:border-0",
|
|
"transition-colors duration-150",
|
|
"data-[state=active]:border-nb-gray-800 data-[state=active]:bg-white dark:data-[state=active]:bg-nb-gray-930",
|
|
"data-[state=inactive]:hover:bg-nb-gray-850 dark:data-[state=inactive]:hover:bg-nb-gray-935",
|
|
isFocusVisible &&
|
|
"focus-visible:ring-2 focus-visible:ring-nb-gray-50/60 focus-visible:ring-offset-2 focus-visible:ring-offset-nb-gray-940",
|
|
className,
|
|
)}
|
|
{...props}
|
|
>
|
|
<Icon
|
|
size={iconSize}
|
|
aria-hidden={"true"}
|
|
className={cn(
|
|
"ml-2 shrink-0 transition-colors duration-150",
|
|
"text-nb-gray-350 dark:text-nb-gray-400",
|
|
"group-data-[state=active]:text-nb-gray-100",
|
|
)}
|
|
/>
|
|
<span
|
|
className={cn(
|
|
"min-w-0 truncate text-sm font-medium transition-colors duration-150",
|
|
"text-nb-gray-350 dark:text-nb-gray-400",
|
|
"group-data-[state=active]:font-semibold group-data-[state=active]:text-nb-gray-100 dark:group-data-[state=active]:font-medium",
|
|
)}
|
|
>
|
|
{title}
|
|
</span>
|
|
{adornment && (
|
|
<div aria-hidden={"true"} className={"ml-auto mr-2 shrink-0"}>
|
|
{adornment}
|
|
</div>
|
|
)}
|
|
</Tabs.Trigger>
|
|
);
|
|
});
|
|
|
|
const Content = forwardRef<HTMLDivElement, Tabs.TabsContentProps>(function VerticalTabsContent(
|
|
{ className, ...props },
|
|
ref,
|
|
) {
|
|
return (
|
|
<Tabs.Content
|
|
ref={ref}
|
|
tabIndex={-1}
|
|
className={cn("outline-none", className)}
|
|
{...props}
|
|
/>
|
|
);
|
|
});
|
|
|
|
export const VerticalTabs = Object.assign(Root, { List, Trigger, Content });
|