1
0
Fork 1
mirror of https://github.com/SomboChea/ui synced 2024-06-26 13:05:33 +07:00
verdaccio-ui/src/components/Label/Label.tsx
2019-06-26 00:10:15 +01:00

31 lines
745 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?: null | undefined;
}
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;