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

45 lines
952 B
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,
firstAction?: (event: Event) => void,
secondAction?: (event: Event) => void,
firstIsSelected: boolean
};
class ButtonGroup extends React.Component<Props> {
render() {
2019-01-30 15:58:55 +01:00
const { firstlabel, secondlabel, firstAction, secondAction, firstIsSelected } = this.props;
2019-01-29 11:06:11 +01:00
2019-01-30 15:58:55 +01:00
let showFirstColor = "";
let showSecondColor = "";
2019-01-29 11:06:11 +01:00
if (firstIsSelected) {
2019-01-29 14:02:36 +01:00
showFirstColor += "link is-selected";
2019-01-29 11:06:11 +01:00
} else {
2019-01-29 14:02:36 +01:00
showSecondColor += "link is-selected";
2019-01-29 11:06:11 +01:00
}
return (
<div className="buttons has-addons">
<Button
label={firstlabel}
color={showFirstColor}
action={firstAction}
/>
<Button
label={secondlabel}
color={showSecondColor}
action={secondAction}
/>
</div>
);
}
}
export default ButtonGroup;