Build BeatHound sequencer app
This commit is contained in:
1 parent
226ababcf1
commit
e23825cdb1
49 files changed
+6455
-2
No files matched your search
@@ -0,0 +1,39 @@
|
||||
import { memo } from 'react';
|
||||
import { getLoopPositionPercent } from '../domain/timeline';
|
||||
import { SOUND_BY_ID } from '../domain/sounds';
|
||||
import type { BeatPoint } from '../domain/sequencer';
|
||||
import type { SoundId } from '../domain/sounds';
|
||||
|
||||
interface BeatSelectionHintProps {
|
||||
selectedBeat: BeatPoint | undefined;
|
||||
focusedSoundId: SoundId | null;
|
||||
colorBySoundId: Partial<Record<SoundId, string>>;
|
||||
totalSteps: number;
|
||||
}
|
||||
|
||||
export const BeatSelectionHint = memo(function BeatSelectionHint({
|
||||
selectedBeat,
|
||||
focusedSoundId,
|
||||
colorBySoundId,
|
||||
totalSteps,
|
||||
}: BeatSelectionHintProps) {
|
||||
const soundId = selectedBeat?.soundId ?? focusedSoundId;
|
||||
if (!soundId) return <p className="timeline-hint" aria-live="polite" />;
|
||||
|
||||
return (
|
||||
<p className="timeline-hint" aria-live="polite">
|
||||
<span
|
||||
className="hint-swatch"
|
||||
style={{ backgroundColor: colorBySoundId[soundId] }}
|
||||
/>
|
||||
{SOUND_BY_ID[soundId].label}
|
||||
{selectedBeat && (
|
||||
<>
|
||||
<span className="hint-separator">·</span>
|
||||
Step {getLoopPositionPercent(selectedBeat.step, totalSteps)}% selected
|
||||
</>
|
||||
)}
|
||||
{!selectedBeat && ' ring selected'}
|
||||
</p>
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user