mirror of
https://github.com/hex248/tsos.git
synced 2026-02-07 18:23:05 +00:00
octave component
This commit is contained in:
24
src/components/controls/OctaveSelector.tsx
Normal file
24
src/components/controls/OctaveSelector.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
const MIN_OCTAVE = 1;
|
||||
const MAX_OCTAVE = 8;
|
||||
|
||||
export default function OctaveSelector({
|
||||
value,
|
||||
onChange,
|
||||
}: {
|
||||
value: number;
|
||||
onChange: (octave: number) => void;
|
||||
}) {
|
||||
return (
|
||||
<div className="flex items-center gap-2">
|
||||
<Button variant="ghost" size="sm" onClick={() => onChange(Math.max(MIN_OCTAVE, value - 1))}>
|
||||
-
|
||||
</Button>
|
||||
<span className="text-sm font-medium tabular-nums">{value}</span>
|
||||
<Button variant="ghost" size="sm" onClick={() => onChange(Math.min(MAX_OCTAVE, value + 1))}>
|
||||
+
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user