feat: ChordDiagram component
This commit is contained in:
23
app/app/components/chord-diagram/chord-diagram.tsx
Normal file
23
app/app/components/chord-diagram/chord-diagram.tsx
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { getPianoNotes, getGuitarVoicing } from '~/lib/chord-voicing';
|
||||||
|
import { PianoKeys } from './piano-keys';
|
||||||
|
import { GuitarFretboard } from './guitar-fretboard';
|
||||||
|
|
||||||
|
export type Instrument = 'piano' | 'guitar';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
chord: string;
|
||||||
|
instrument: Instrument;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ChordDiagram({ chord, instrument }: Props) {
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col items-center gap-2 p-2">
|
||||||
|
<span className="text-xs font-mono font-semibold text-primary">{chord}</span>
|
||||||
|
{instrument === 'piano' ? (
|
||||||
|
<PianoKeys notes={getPianoNotes(chord)} />
|
||||||
|
) : (
|
||||||
|
<GuitarFretboard voicing={getGuitarVoicing(chord)} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user