mirror of
https://github.com/SomboChea/ui
synced 2024-09-30 21:37:48 +07:00
31 lines
732 B
TypeScript
31 lines
732 B
TypeScript
|
import React from 'react';
|
||
|
import styled from 'react-emotion';
|
||
|
import { fontWeight } from '../../utils/styles/sizes';
|
||
|
|
||
|
interface Props {
|
||
|
text: string;
|
||
|
capitalize?: boolean;
|
||
|
weight?: string;
|
||
|
modifiers?: any;
|
||
|
}
|
||
|
|
||
|
const Wrapper = styled('div')`
|
||
|
font-weight: ${({ weight }) => {
|
||
|
// @ts-ignore
|
||
|
return fontWeight[weight];
|
||
|
}};
|
||
|
text-transform: ${({ capitalize }) => (capitalize ? 'capitalize' : 'none')};
|
||
|
${({ modifiers }: Props) => modifiers && modifiers};
|
||
|
`;
|
||
|
|
||
|
const Label: React.FC<Props> = ({ text = '', capitalize = false, weight = 'regular', ...props }) => {
|
||
|
return (
|
||
|
// @ts-ignore
|
||
|
<Wrapper capitalize={capitalize} weight={weight} {...props}>
|
||
|
{text}
|
||
|
</Wrapper>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default Label;
|