2023-05-22 17:38:31 -07:00
|
|
|
import { useMemo } from 'react';
|
2023-06-03 18:03:32 -07:00
|
|
|
import { Text } from '/@/renderer/components';
|
2023-05-22 17:38:31 -07:00
|
|
|
import { LyricLine } from '/@/renderer/features/lyrics/lyric-line';
|
|
|
|
|
|
|
|
|
|
interface UnsynchronizedLyricsProps {
|
|
|
|
|
lyrics: string;
|
2023-06-03 18:03:32 -07:00
|
|
|
source: string | null;
|
2023-05-22 17:38:31 -07:00
|
|
|
}
|
|
|
|
|
|
2023-06-03 18:03:32 -07:00
|
|
|
export const UnsynchronizedLyrics = ({ lyrics, source }: UnsynchronizedLyricsProps) => {
|
2023-05-22 17:38:31 -07:00
|
|
|
const lines = useMemo(() => {
|
|
|
|
|
return lyrics.split('\n');
|
|
|
|
|
}, [lyrics]);
|
|
|
|
|
|
|
|
|
|
return (
|
2023-06-03 18:03:32 -07:00
|
|
|
<div className="unsynchronized-lyrics">
|
|
|
|
|
{source && <Text $noSelect>Lyrics provided by: {source}</Text>}
|
2023-05-22 17:38:31 -07:00
|
|
|
{lines.map((text, idx) => (
|
|
|
|
|
<LyricLine
|
|
|
|
|
key={idx}
|
|
|
|
|
id={`lyric-${idx}`}
|
2023-05-28 14:31:49 -07:00
|
|
|
text={text}
|
2023-05-22 17:38:31 -07:00
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|