2023-05-22 17:38:31 -07:00
|
|
|
import { useMemo } from 'react';
|
2023-06-04 16:19:13 -07:00
|
|
|
import styled from 'styled-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-04 16:19:13 -07:00
|
|
|
const UnsynchronizedLyricsContainer = styled.div`
|
|
|
|
|
padding: 5rem 0;
|
|
|
|
|
`;
|
|
|
|
|
|
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-04 16:19:13 -07:00
|
|
|
<UnsynchronizedLyricsContainer className="unsynchronized-lyrics">
|
|
|
|
|
{source && (
|
|
|
|
|
<LyricLine
|
|
|
|
|
className="lyric-credit"
|
|
|
|
|
text={`Lyrics provided by ${source}`}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
2023-05-22 17:38:31 -07:00
|
|
|
{lines.map((text, idx) => (
|
|
|
|
|
<LyricLine
|
|
|
|
|
key={idx}
|
2023-06-04 16:19:13 -07:00
|
|
|
className="unsynchronized active"
|
2023-05-22 17:38:31 -07:00
|
|
|
id={`lyric-${idx}`}
|
2023-05-28 14:31:49 -07:00
|
|
|
text={text}
|
2023-05-22 17:38:31 -07:00
|
|
|
/>
|
|
|
|
|
))}
|
2023-06-04 16:19:13 -07:00
|
|
|
</UnsynchronizedLyricsContainer>
|
2023-05-22 17:38:31 -07:00
|
|
|
);
|
|
|
|
|
};
|