Fix styling on unsync lyrics

This commit is contained in:
jeffvli 2023-06-04 16:19:13 -07:00 committed by Jeff
parent feb61c28d7
commit 190dd71b3c
2 changed files with 18 additions and 4 deletions

View file

@ -20,6 +20,10 @@ const StyledText = styled(TextTitle)`
opacity: 1; opacity: 1;
} }
&.active.unsynchronized {
opacity: 0.8;
}
transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out; transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
`; `;

View file

@ -1,5 +1,5 @@
import { useMemo } from 'react'; import { useMemo } from 'react';
import { Text } from '/@/renderer/components'; import styled from 'styled-components';
import { LyricLine } from '/@/renderer/features/lyrics/lyric-line'; import { LyricLine } from '/@/renderer/features/lyrics/lyric-line';
interface UnsynchronizedLyricsProps { interface UnsynchronizedLyricsProps {
@ -7,21 +7,31 @@ interface UnsynchronizedLyricsProps {
source: string | null; source: string | null;
} }
const UnsynchronizedLyricsContainer = styled.div`
padding: 5rem 0;
`;
export const UnsynchronizedLyrics = ({ lyrics, source }: UnsynchronizedLyricsProps) => { export const UnsynchronizedLyrics = ({ lyrics, source }: UnsynchronizedLyricsProps) => {
const lines = useMemo(() => { const lines = useMemo(() => {
return lyrics.split('\n'); return lyrics.split('\n');
}, [lyrics]); }, [lyrics]);
return ( return (
<div className="unsynchronized-lyrics"> <UnsynchronizedLyricsContainer className="unsynchronized-lyrics">
{source && <Text $noSelect>Lyrics provided by {source}</Text>} {source && (
<LyricLine
className="lyric-credit"
text={`Lyrics provided by ${source}`}
/>
)}
{lines.map((text, idx) => ( {lines.map((text, idx) => (
<LyricLine <LyricLine
key={idx} key={idx}
className="unsynchronized active"
id={`lyric-${idx}`} id={`lyric-${idx}`}
text={text} text={text}
/> />
))} ))}
</div> </UnsynchronizedLyricsContainer>
); );
}; };