Files
songs2yt/components/PrivacyToggle.tsx
T
2026-07-17 02:23:59 +02:00

36 lines
903 B
TypeScript

"use client";
import { Privacy } from "@prisma/client";
type Props = {
value: Privacy;
onChange: (value: Privacy) => void;
};
const OPTIONS: { value: Privacy; label: string }[] = [
{ value: "PUBLIC", label: "Public" },
{ value: "PRIVATE", label: "Private" },
{ value: "UNLISTED", label: "Unlisted" },
];
export function PrivacyToggle({ value, onChange }: Props) {
return (
<div className="flex rounded border border-gray-600 overflow-hidden">
{OPTIONS.map((opt) => (
<button
key={opt.value}
type="button"
onClick={() => onChange(opt.value)}
className={`flex-1 px-3 py-2 text-sm transition-colors ${
value === opt.value
? "bg-accent text-white"
: "bg-surface-light text-gray-300 hover:bg-gray-700"
}`}
>
{opt.label}
</button>
))}
</div>
);
}