mirror of
https://github.com/revoltchat/revite.git
synced 2025-02-24 01:01:00 -05:00
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
|
import styled, { css } from 'styled-components';
|
||
|
import { Children } from '../../types/Preact';
|
||
|
|
||
|
interface Props {
|
||
|
block?: boolean;
|
||
|
error?: Children;
|
||
|
children?: Children;
|
||
|
type?: "default" | "subtle" | "error";
|
||
|
}
|
||
|
|
||
|
const OverlineBase = styled.div<Omit<Props, 'children' | 'error'>>`
|
||
|
display: inline;
|
||
|
margin: 0.4em 0;
|
||
|
margin-top: 0.8em;
|
||
|
|
||
|
font-size: 14px;
|
||
|
font-weight: 600;
|
||
|
color: var(--foreground);
|
||
|
text-transform: uppercase;
|
||
|
|
||
|
${ props => props.type === 'subtle' && css`
|
||
|
font-size: 12px;
|
||
|
color: var(--secondary-foreground);
|
||
|
` }
|
||
|
|
||
|
${ props => props.type === 'error' && css`
|
||
|
font-size: 12px;
|
||
|
font-weight: 400;
|
||
|
color: var(--error);
|
||
|
` }
|
||
|
|
||
|
${ props => props.block && css`display: block;` }
|
||
|
`;
|
||
|
|
||
|
export function Overline(props: Props) {
|
||
|
return (
|
||
|
<OverlineBase {...props}>
|
||
|
{ props.children }
|
||
|
{ props.children && props.error && <> · </> }
|
||
|
{ props.error && (
|
||
|
<Overline type="error">
|
||
|
{ props.error }
|
||
|
</Overline>
|
||
|
) }
|
||
|
</OverlineBase>
|
||
|
)
|
||
|
}
|