diff --git a/web/components/label.css b/web/components/label.css new file mode 100644 --- /dev/null +++ b/web/components/label.css @@ -0,0 +1,5 @@ +div.label { + line-height: 1.5; + padding: 4px 8px; + border-radius: 8px; +} diff --git a/web/components/label.react.js b/web/components/label.react.js new file mode 100644 --- /dev/null +++ b/web/components/label.react.js @@ -0,0 +1,38 @@ +// @flow + +import * as React from 'react'; + +import css from './label.css'; + +type Props = { + +size?: string | number, + +color?: string, + +bg?: string, + +children: React.Node, +}; + +function Label(props: Props): React.Node { + const { + size = '12px', + color = 'var(--label-default-color)', + bg = 'var(--label-default-bg)', + children, + } = props; + + const labelStyle = React.useMemo( + () => ({ + fontSize: size, + color: color, + background: bg, + }), + [bg, color, size], + ); + + return ( +