Files
SCM-Manager/scm-ui-components/packages/ui-components/src/buttons/ButtonGroup.js

47 lines
1.0 KiB
JavaScript
Raw Normal View History

2019-01-29 11:06:11 +01:00
// @flow
import React from "react";
import Button from "./Button";
type Props = {
firstlabel: string,
secondlabel: string,
firstColor: string,
secondColor: string,
firstAction?: (event: Event) => void,
secondAction?: (event: Event) => void,
firstIsSelected: boolean
};
class ButtonGroup extends React.Component<Props> {
render() {
const { firstlabel, secondlabel, firstColor, secondColor, firstAction, secondAction, firstIsSelected } = this.props;
let showFirstColor = firstColor;
let showSecondColor = secondColor;
if (firstIsSelected) {
showFirstColor += " is-selected";
} else {
showSecondColor += " is-selected";
}
return (
<div className="buttons has-addons">
<Button
label={firstlabel}
color={showFirstColor}
action={firstAction}
/>
<Button
label={secondlabel}
color={showSecondColor}
action={secondAction}
/>
</div>
);
}
}
export default ButtonGroup;