Files
flood/client/src/javascript/ui/components/FormGroup.tsx
2020-11-15 23:03:47 +08:00

31 lines
644 B
TypeScript

import * as React from 'react';
import FormRowItem from './FormRowItem';
import type {FormRowItemProps} from './FormRowItem';
export default class FormRowItemGroup extends React.Component<{
label?: string;
width?: FormRowItemProps['width'];
}> {
getLabel(): React.ReactNode {
const {label} = this.props;
if (label) {
return <label className="form__element__label">{label}</label>;
}
return undefined;
}
render() {
const {children, width} = this.props;
return (
<FormRowItem className="form__group" width={width}>
{this.getLabel()}
{children}
</FormRowItem>
);
}
}