mirror of
https://github.com/SomboChea/ui
synced 2026-01-18 09:06:14 +07:00
initial commit
This commit is contained in:
27
src/components/Label/index.js
Normal file
27
src/components/Label/index.js
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* @prettier
|
||||
* @flow
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import styled from 'react-emotion';
|
||||
import { fontWeight } from '../../utils/styles/sizes';
|
||||
|
||||
import type { Node } from 'react';
|
||||
import { IProps } from './types';
|
||||
|
||||
const Wrapper = styled.div`
|
||||
font-weight: ${({ weight }) => fontWeight[weight]};
|
||||
text-transform: ${({ capitalize }) => (capitalize ? 'capitalize' : 'none')};
|
||||
${({ modifiers }: IProps) => modifiers && modifiers};
|
||||
`;
|
||||
|
||||
const Label = ({ text = '', capitalize = false, weight = 'regular', ...props }: IProps): Node => {
|
||||
return (
|
||||
<Wrapper capitalize={capitalize} weight={weight} {...props}>
|
||||
{text}
|
||||
</Wrapper>
|
||||
);
|
||||
};
|
||||
|
||||
export default Label;
|
||||
12
src/components/Label/types.js
Normal file
12
src/components/Label/types.js
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @prettier
|
||||
* @flow
|
||||
*/
|
||||
import type { Styles } from '../../../../types';
|
||||
|
||||
export interface IProps {
|
||||
text: string;
|
||||
capitalize?: boolean;
|
||||
weight?: string;
|
||||
modifiers?: Styles;
|
||||
}
|
||||
Reference in New Issue
Block a user