UNPKG

@6thquake/react-material

Version:

React components that implement Google's Material Design.

61 lines (54 loc) 1.53 kB
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose"; import React, { Component } from 'react'; import FormLabel from '@material-ui/core/FormLabel'; import yellow from '../colors/yellow'; import PropTypes from 'prop-types'; import withStyles from '../styles/withStyles'; const style = theme => ({ root: {}, label: { color: theme.palette.grey[300], '&$labelForcus': { // color: `${theme.palette.common.white}` color: `${yellow[500]}` } }, labelForcus: {} }); class FormLabelWrapper extends Component { constructor(props) { super(props); this.state = {}; } render() { const _this$props = this.props, { isDark, classes } = _this$props, others = _objectWithoutPropertiesLoose(_this$props, ["isDark", "classes"]); let labelClasses = isDark ? { root: classes.label, focused: classes.labelForcus } : {}; return React.createElement(FormLabel, _extends({ classes: labelClasses }, others)); } } process.env.NODE_ENV !== "production" ? FormLabelWrapper.propTypes = { /** * Override or extend the styles applied to the component. * See [CSS API](#css-api) below for more details. */ classes: PropTypes.object.isRequired, /** * background is dark */ isDark: PropTypes.bool } : void 0; FormLabelWrapper.defaultProps = { isDark: false }; export default withStyles(style)(FormLabelWrapper);