5180 fichiers 38.5 Mo 0 téléchargements 236 vues mis à jour il y a 5 heures ui
nitro-v36-with-renderer-v36 / src / components / soundboard / SoundboardShelfView.tsx
SoundboardShelfView.tsx 1.7 Ko Télécharger le fichier
import { FC } from 'react';
import { DisplaySoundboardSound } from '../../hooks/soundboard/soundboardPresentation';
import { SOUNDBOARD_TONE_CLASSES } from './SoundboardPadView';
import { BaseButton } from '../../common/BaseButton';
import { Hint } from '../../common/Tooltip';
import { NativeTextTree } from '../../common/native-text/NativeTextTree';

interface SoundboardShelfViewProps {
    label: string;
    sounds: DisplaySoundboardSound[];
    disabled: boolean;
    playingSoundId?: number | null;
    onPlay: (sound: DisplaySoundboardSound) => void;
}

/** A short row of round buttons above the list: the pads a player reaches for most. */
export const SoundboardShelfView: FC<SoundboardShelfViewProps> = ({ label, sounds, disabled, playingSoundId = null, onPlay }) => (
    <NativeTextTree>
        <div className="soundboard-shelf" data-testid="soundboard-shelf">
            <span className="soundboard-shelf__label">{label}</span>
            <div className="soundboard-shelf__row">
                {sounds.map((sound) => (
                    <Hint key={sound.id} content={sound.name}>
                        <BaseButton
                            type="button"
                            aria-label={sound.name}
                            aria-disabled={disabled}
                            data-playing={sound.id === playingSoundId || undefined}
                            onClick={() => !disabled && onPlay(sound)}
                            className={`soundboard-shelf__button ${SOUNDBOARD_TONE_CLASSES[sound.tone]}`}
                        >
                            ♪
                        </BaseButton>
                    </Hint>
                ))}
            </div>
        </div>
    </NativeTextTree>
);
15Sujets
1Dépôts
20Membres
2En ligne
Profile
Inscrit
Dernière visite
Messages
0
Votes positifs
0
Votes négatifs
0

Nous utilisons des cookies pour assurer le bon fonctionnement du site et améliorer votre expérience. en savoir plus

Autoriser