diff --git a/front/components/VirtualPiano/Octave.tsx b/front/components/VirtualPiano/Octave.tsx index d158d36..97587cc 100644 --- a/front/components/VirtualPiano/Octave.tsx +++ b/front/components/VirtualPiano/Octave.tsx @@ -5,7 +5,7 @@ import { octaveKeys, Accidental, } from "../../models/Piano"; -import { Box, Row, Pressable, ZStack } from "native-base"; +import { Box, Row, Pressable, ZStack, Text } from "native-base"; const notesList: Array = ["C", "D", "E", "F", "G", "A", "B"]; const accidentalsList: Array = ["#", "b", "##", "bb"]; @@ -35,15 +35,20 @@ const Octave = ({ onNoteUp, }: OctaveProps) => { const oK: PianoKey[] = octaveKeys.map((k) => { - return { ...k, number: number }; + return new PianoKey(k.note, k.accidental, number); }); const startNoteIndex = getKeyIndex(startNote, oK); const endNoteIndex = getKeyIndex(endNote, oK); const keys = oK.slice(startNoteIndex, endNoteIndex + 1); - const whiteKeys = octaveKeys.filter((k) => k?.accidental === undefined); - const blackKeys = octaveKeys.filter((k) => k?.accidental !== undefined); + const whiteKeys = keys.filter((k) => k?.accidental === undefined); + const blackKeys = keys.filter((k) => k?.accidental !== undefined); + + const whiteKeyWidthExpr = '50px'; + const whiteKeyHeightExpr = '200px'; + const blackKeyWidthExpr = '25px'; + const blackKeyHeightExpr = '100px'; return ( @@ -52,18 +57,22 @@ const Octave = ({ {whiteKeys.map((key, i) => { return ( onNoteDown(key)} onPressOut={() => onNoteUp(key)} > - {key.toString()} + + {key.note} + ); @@ -73,24 +82,32 @@ const Octave = ({ {blackKeys.map((key, i) => { return ( onNoteDown(key)} onPressOut={() => onNoteUp(key)} > 1) as unknown as number)) * 50 + (50 - (25 / 2))}px`, + top: "0px", + justifyContent: "flex-end", + alignItems: "center", + }} > - {key.toString()} + + {key.note + key.accidental} + ); })} - ;