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

25 lines
508 B
TypeScript
Raw Normal View History

2023-05-22 17:38:31 -07:00
import { useMemo } from 'react';
import { LyricLine } from '/@/renderer/features/lyrics/lyric-line';
interface UnsynchronizedLyricsProps {
lyrics: string;
}
export const UnsynchronizedLyrics = ({ lyrics }: UnsynchronizedLyricsProps) => {
const lines = useMemo(() => {
return lyrics.split('\n');
}, [lyrics]);
return (
<div>
{lines.map((text, idx) => (
<LyricLine
key={idx}
id={`lyric-${idx}`}
text={text}
2023-05-22 17:38:31 -07:00
/>
))}
</div>
);
};