All files / src/components/admin TaxonomyTypeSelector.tsx

100% Statements 3/3
100% Branches 2/2
100% Functions 3/3
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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                                  95x         1056x     6x                              
import { Card, CardContent } from "../ui/card";
import type {
	TaxonomyType,
	TaxonomyConfig,
} from "../../pages/admin/taxonomy.config";
 
interface TaxonomyTypeSelectorProps {
	configs: TaxonomyConfig[];
	activeTab: TaxonomyType;
	onTabChange: (tab: TaxonomyType) => void;
}
 
export function TaxonomyTypeSelector({
	configs,
	activeTab,
	onTabChange,
}: TaxonomyTypeSelectorProps) {
	return (
		<Card>
			<CardContent className="pt-6">
				<div className="flex flex-wrap gap-2">
					{configs.map((config) => (
						<button
							key={config.key}
							type="button"
							onClick={() => onTabChange(config.key)}
							className={`px-4 py-2 rounded-md text-sm font-medium transition-colors ${
								activeTab === config.key
									? "bg-primary-600 text-foreground-inverse"
									: "bg-background-muted text-foreground-default hover:bg-background-subtle"
							}`}
						>
							{config.label}
						</button>
					))}
				</div>
			</CardContent>
		</Card>
	);
}