1
0
Fork 1
mirror of https://github.com/SomboChea/ui synced 2024-05-20 18:31:37 +07:00
verdaccio-ui/src/components/Label/Label.tsx
2019-12-12 12:10:27 -03:00

31 lines
712 B
TypeScript

import React from 'react';
import styled from '@emotion/styled';
import { Theme } from '../../design-tokens/theme';
interface Props {
text: string;
capitalize?: boolean;
weight?: string;
}
interface WrapperProps {
capitalize: boolean;
weight: string;
}
const Wrapper = styled('div')<WrapperProps & { theme?: Theme }>(props => ({
fontWeight: props.theme && props.theme.fontWeight[props.weight],
textTransform: props.capitalize ? 'capitalize' : 'none',
}));
const Label: React.FC<Props> = ({ text = '', capitalize = false, weight = 'regular', ...props }) => {
return (
<Wrapper capitalize={capitalize} weight={weight} {...props}>
{text}
</Wrapper>
);
};
export default Label;