mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-07 05:55:44 +01:00
added ButtonGroup component
This commit is contained in:
@@ -0,0 +1,46 @@
|
|||||||
|
// @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;
|
||||||
Reference in New Issue
Block a user