2019-01-29 11:06:11 +01:00
|
|
|
// @flow
|
2019-02-07 09:29:53 +01:00
|
|
|
import * as React from "react";
|
2019-06-20 13:40:12 +02:00
|
|
|
import classNames from "classnames";
|
2019-01-29 11:06:11 +01:00
|
|
|
|
|
|
|
|
type Props = {
|
2019-02-07 09:29:53 +01:00
|
|
|
className?: string,
|
|
|
|
|
children: React.Node
|
2019-01-29 11:06:11 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class ButtonGroup extends React.Component<Props> {
|
2019-02-07 09:29:53 +01:00
|
|
|
render() {
|
2019-06-20 14:57:00 +02:00
|
|
|
const { className, children } = this.props;
|
2019-06-20 13:40:12 +02:00
|
|
|
|
2019-06-25 12:54:20 +02:00
|
|
|
const childWrapper = [];
|
2019-06-20 14:57:00 +02:00
|
|
|
React.Children.forEach(children, child => {
|
|
|
|
|
if (child) {
|
|
|
|
|
childWrapper.push(<p className="control">{child}</p>);
|
|
|
|
|
}
|
|
|
|
|
});
|
2019-06-20 13:40:12 +02:00
|
|
|
|
2019-01-29 11:06:11 +01:00
|
|
|
return (
|
2019-06-20 14:57:00 +02:00
|
|
|
<div className={classNames("field", "is-grouped", className)}>
|
|
|
|
|
{childWrapper}
|
2019-01-29 11:06:11 +01:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default ButtonGroup;
|