feishin/src/renderer/features/lyrics/lyrics-actions.tsx

60 lines
1.5 KiB
TypeScript
Raw Normal View History

2023-06-08 03:40:58 -07:00
import { RiAddFill, RiSubtractFill } from 'react-icons/ri';
import { LyricsOverride } from '/@/renderer/api/types';
2023-06-08 03:40:58 -07:00
import { Button, NumberInput } from '/@/renderer/components';
import { openLyricSearchModal } from '/@/renderer/features/lyrics/components/lyrics-search-form';
import { useCurrentSong } from '/@/renderer/store';
interface LyricsActionsProps {
onSearchOverride?: (params: LyricsOverride) => void;
}
export const LyricsActions = ({ onSearchOverride }: LyricsActionsProps) => {
2023-06-08 03:40:58 -07:00
const currentSong = useCurrentSong();
return (
<>
<Button
uppercase
variant="subtle"
2023-06-08 03:40:58 -07:00
onClick={() =>
openLyricSearchModal({
artist: currentSong?.artistName,
name: currentSong?.name,
onSearchOverride,
2023-06-08 03:40:58 -07:00
})
}
>
Search
</Button>
<Button
tooltip={{ label: 'Decrease offset', openDelay: 500 }}
variant="subtle"
2023-06-08 03:40:58 -07:00
>
<RiSubtractFill />
</Button>
<NumberInput
styles={{ input: { textAlign: 'center' } }}
width={55}
/>
<Button
tooltip={{ label: 'Increase offset', openDelay: 500 }}
variant="subtle"
2023-06-08 03:40:58 -07:00
>
<RiAddFill />
</Button>
<Button
uppercase
variant="subtle"
2023-06-08 03:40:58 -07:00
onClick={() =>
openLyricSearchModal({
artist: currentSong?.artistName,
name: currentSong?.name,
})
}
>
Clear
</Button>
</>
);
};