Spaces:
Running
Running
| 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> | |
| ); | |
| } | |