feishin/src/renderer/features/lyrics/lyric-line.tsx

42 lines
1 KiB
TypeScript
Raw Normal View History

2023-05-22 17:38:31 -07:00
import { ComponentPropsWithoutRef } from 'react';
import { TextTitle } from '/@/renderer/components/text-title';
import { TitleProps } from '@mantine/core';
import styled from 'styled-components';
2023-05-22 17:38:31 -07:00
interface LyricLineProps extends ComponentPropsWithoutRef<'div'> {
alignment: 'left' | 'center' | 'right';
fontSize: number;
2023-07-01 19:10:05 -07:00
text: string;
2023-05-22 17:38:31 -07:00
}
const StyledText = styled(TextTitle)<TitleProps & { $alignment: string; $fontSize: number }>`
2023-07-01 19:10:05 -07:00
color: var(--main-fg);
font-weight: 400;
text-align: ${(props) => props.$alignment};
font-size: ${(props) => props.$fontSize}px;
2023-07-01 19:10:05 -07:00
opacity: 0.5;
2023-07-01 19:10:05 -07:00
&.active {
font-weight: 800;
opacity: 1;
}
2023-06-03 18:03:32 -07:00
&.unsynchronized {
opacity: 1;
2023-07-01 19:10:05 -07:00
}
2023-06-04 16:19:13 -07:00
2023-07-01 19:10:05 -07:00
transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
`;
export const LyricLine = ({ text, alignment, fontSize, ...props }: LyricLineProps) => {
return (
<StyledText
$alignment={alignment}
$fontSize={fontSize}
{...props}
>
{text}
</StyledText>
);
2023-05-22 17:38:31 -07:00
};