Spaces:
Running
Running
File size: 1,139 Bytes
7dfae77 | 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 42 43 | import type { InputMode } from "../types";
interface SourceModeSwitchProps {
value: InputMode;
onChange: (mode: InputMode) => void;
disabled?: boolean;
}
export function SourceModeSwitch({
value,
onChange,
disabled,
}: SourceModeSwitchProps) {
return (
<div className="grid grid-cols-2 gap-2 rounded-xl bg-bg-card p-1">
<button
type="button"
onClick={() => onChange("upload")}
disabled={disabled}
className={`rounded-lg px-4 py-2.5 text-sm font-medium transition-colors ${
value === "upload"
? "bg-accent text-white"
: "text-text-secondary hover:text-text-primary"
} disabled:opacity-50`}
>
Upload file
</button>
<button
type="button"
onClick={() => onChange("link")}
disabled={disabled}
className={`rounded-lg px-4 py-2.5 text-sm font-medium transition-colors ${
value === "link"
? "bg-accent text-white"
: "text-text-secondary hover:text-text-primary"
} disabled:opacity-50`}
>
Paste link
</button>
</div>
);
}
|