File size: 1,533 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
44
45
46
47
48
49
50
51
52
53
54
55
import type { OutputFormat } from "../types";

interface OutputFormatSelectorProps {
  value: OutputFormat;
  onChange: (format: OutputFormat) => void;
  disabled?: boolean;
}

const OPTIONS: OutputFormat[] = ["wav", "mp3", "aac"];

export function OutputFormatSelector({
  value,
  onChange,
  disabled,
}: OutputFormatSelectorProps) {
  return (
    <div className="space-y-3">
      <div className="flex items-center justify-between gap-3">
        <span className="text-sm font-medium text-text-secondary">
          Output format
        </span>
        <span className="text-xs text-text-secondary">
          Defaults from the original source when supported
        </span>
      </div>

      <div className="grid grid-cols-3 gap-2">
        {OPTIONS.map((format) => {
          const selected = value === format;

          return (
            <button
              key={format}
              type="button"
              onClick={() => onChange(format)}
              disabled={disabled}
              className={`
                rounded-lg border px-3 py-2 text-sm font-medium uppercase tracking-wide transition-all
                ${
                  selected
                    ? "border-accent bg-accent/10 text-accent"
                    : "border-border text-text-secondary hover:border-text-secondary hover:text-text-primary"
                }
                disabled:opacity-50
              `}
            >
              {format}
            </button>
          );
        })}
      </div>
    </div>
  );
}