forked from abner/for-legacy-web
Add prettier.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import styled, { css } from 'styled-components';
|
||||
import { Children } from '../../types/Preact';
|
||||
import styled, { css } from "styled-components";
|
||||
import { Children } from "../../types/Preact";
|
||||
|
||||
interface Props {
|
||||
block?: boolean;
|
||||
@@ -8,7 +8,7 @@ interface Props {
|
||||
type?: "default" | "subtle" | "error";
|
||||
}
|
||||
|
||||
const OverlineBase = styled.div<Omit<Props, 'children' | 'error'>>`
|
||||
const OverlineBase = styled.div<Omit<Props, "children" | "error">>`
|
||||
display: inline;
|
||||
margin: 0.4em 0;
|
||||
margin-top: 0.8em;
|
||||
@@ -18,30 +18,34 @@ const OverlineBase = styled.div<Omit<Props, 'children' | 'error'>>`
|
||||
color: var(--foreground);
|
||||
text-transform: uppercase;
|
||||
|
||||
${ props => props.type === 'subtle' && css`
|
||||
font-size: 12px;
|
||||
color: var(--secondary-foreground);
|
||||
` }
|
||||
${(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.type === "error" &&
|
||||
css`
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
color: var(--error);
|
||||
`}
|
||||
|
||||
${ props => props.block && css`display: block;` }
|
||||
${(props) =>
|
||||
props.block &&
|
||||
css`
|
||||
display: block;
|
||||
`}
|
||||
`;
|
||||
|
||||
export default function Overline(props: Props) {
|
||||
return (
|
||||
<OverlineBase {...props}>
|
||||
{ props.children }
|
||||
{ props.children && props.error && <> · </> }
|
||||
{ props.error && (
|
||||
<Overline type="error">
|
||||
{ props.error }
|
||||
</Overline>
|
||||
) }
|
||||
{props.children}
|
||||
{props.children && props.error && <> · </>}
|
||||
{props.error && <Overline type="error">{props.error}</Overline>}
|
||||
</OverlineBase>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user