diff --git a/app/app/components/chord-chart.tsx b/app/app/components/chord-chart.tsx new file mode 100644 index 0000000..7d50539 --- /dev/null +++ b/app/app/components/chord-chart.tsx @@ -0,0 +1,48 @@ +import type { Section } from "~/lib/types"; + +interface Props { + sections: Section[]; +} + +function buildChordRow(chords: { offset: number; chord: string }[]): string { + let row = ""; + for (const { offset, chord } of chords) { + while (row.length < offset) row += " "; + row += chord; + } + return row; +} + +function SectionBlock({ section }: { section: Section }) { + return ( +
[{section.label}]
+ )} + {section.lines.map((line, i) => ( +
+ {buildChordRow(line.chords)}
+
+ )}
+ {line.text && (
+
+ {line.text}
+
+ )}
+