import React, { ReactElement } from 'react' import FieldDocLabel from './FieldDocLabel' import Doc from './Doc' type FieldsetProps = { label: string, fieldSpec?: { doc?: string }, action?: ReactElement, }; type FieldsetState = { showDoc: boolean }; let IDX = 0; export default class Fieldset extends React.Component { _labelId: string; constructor (props: FieldsetProps) { super(props); this._labelId = `fieldset_label_${(IDX++)}`; this.state = { showDoc: false, } } onToggleDoc = (val: boolean) => { this.setState({ showDoc: val }); } render () { return
{this.props.fieldSpec &&
} {!this.props.fieldSpec &&
{this.props.label}
}
{this.props.action}
{this.props.children}
{this.props.fieldSpec &&
}
} }