Skip to content

Instantly share code, notes, and snippets.

@apps-manager
Created August 13, 2018 21:38
Show Gist options
  • Save apps-manager/5858b5783a72384b9ea00c6996117c2e to your computer and use it in GitHub Desktop.
Save apps-manager/5858b5783a72384b9ea00c6996117c2e to your computer and use it in GitHub Desktop.
import React from 'react';
import PropTypes from 'prop-types';
import {Grid} from 'pivotal-ui/react/flex-grids';
import classnames from 'classnames';
export class FormRow extends React.Component {
static propTypes = {
state: PropTypes.object,
children: PropTypes.node,
className: PropTypes.string,
id: PropTypes.string,
wrapper: PropTypes.func
};
render() {
const {state, children, className, id, wrapper} = this.props;
const row = (<Grid {...{id, className: classnames(className, 'form-row')}}>{children}</Grid>);
return wrapper ? React.cloneElement(wrapper(state), {children: row}) : row;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment