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

48 lines
1.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-09-15 20:42:38 -07:00
padding: 0 1rem;
font-size: ${(props) => props.$fontSize}px;
font-weight: 600;
2023-09-15 20:42:38 -07:00
color: var(--main-fg);
text-align: ${(props) => props.$alignment};
2023-07-01 19:10:05 -07:00
opacity: 0.5;
2023-09-15 20:42:38 -07:00
2024-08-23 08:19:27 -07:00
transition:
opacity 0.3s ease-in-out,
transform 0.3s ease-in-out;
2023-07-01 19:10:05 -07:00
&.active {
opacity: 1;
}
2023-06-03 18:03:32 -07:00
&.unsynchronized {
opacity: 1;
2023-07-01 19:10:05 -07:00
}
2024-07-03 08:24:31 +00:00
&.synchronized {
cursor: pointer;
}
`;
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
};