From ec15f83b947fb2daf4ca1a72e3af527dc89512a3 Mon Sep 17 00:00:00 2001 From: Vijay Aravamudhan Date: Fri, 15 Oct 2021 16:22:25 +0530 Subject: chore: move 'packages/forms' into 'src' (no longer an injected package) (#2079) --- src/components/ui/label/index.tsx | 52 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/components/ui/label/index.tsx (limited to 'src/components/ui/label/index.tsx') diff --git a/src/components/ui/label/index.tsx b/src/components/ui/label/index.tsx new file mode 100644 index 000000000..4d86f23f7 --- /dev/null +++ b/src/components/ui/label/index.tsx @@ -0,0 +1,52 @@ +import classnames from 'classnames'; +import { Classes } from 'jss'; +import { Component, LabelHTMLAttributes } from 'react'; +import injectSheet from 'react-jss'; + +import { IFormField } from '../typings/generic'; + +import styles from './styles'; + +interface ILabel extends IFormField, LabelHTMLAttributes { + classes: Classes; + isRequired: boolean; +} + +class LabelComponent extends Component { + static defaultProps = { + showLabel: true, + }; + + render() { + const { + title, + showLabel, + classes, + className, + children, + htmlFor, + isRequired, + } = this.props; + + if (!showLabel) return children; + + return ( + + ); + } +} + +export const Label = injectSheet(styles)(LabelComponent); -- cgit v1.2.3-70-g09d2