mike/frontend/src/app/components/shared/ToolbarTabs.tsx
2026-04-29 19:49:06 +02:00

44 lines
1.2 KiB
TypeScript

import React from "react";
interface Tab<T extends string> {
id: T;
label: string;
}
interface Props<T extends string> {
tabs: Tab<T>[];
active: T;
onChange: (id: T) => void;
/** Optional content rendered on the right side of the toolbar */
actions?: React.ReactNode;
}
export function ToolbarTabs<T extends string>({
tabs,
active,
onChange,
actions,
}: Props<T>) {
return (
<div className="flex items-center h-10 px-8 border-b border-gray-200">
<div className="flex-1 flex items-center gap-5">
{tabs.map((tab) => (
<button
key={tab.id}
onClick={() => onChange(tab.id)}
className={`text-xs transition-colors ${
active === tab.id
? "font-medium text-gray-700"
: "font-normal text-gray-500 hover:text-gray-700"
}`}
>
{tab.label}
</button>
))}
</div>
{actions && (
<div className="flex items-center gap-1">{actions}</div>
)}
</div>
);
}