used new Component

This commit is contained in:
Florian Scholdei
2019-01-29 14:02:36 +01:00
parent 6420e20cfe
commit c331aa55e3
4 changed files with 21 additions and 30 deletions

View File

@@ -0,0 +1,60 @@
// @flow
import React from "react";
import { translate } from "react-i18next";
import { ButtonGroup } from "@scm-manager/ui-components";
type Props = {
t: string => string,
historyIsSelected: boolean,
showHistory: boolean => void
};
class FileButtonGroup extends React.Component<Props> {
showHistory = () => {
this.props.showHistory(true);
};
showSources = () => {
this.props.showHistory(false);
};
render() {
const { t, historyIsSelected } = this.props;
const sourcesLabel = (
<>
<span className="icon">
<i className="fas fa-code" />
</span>
<span className="is-hidden-mobile">
{t("sources.content.sourcesButton")}
</span>
</>
);
const historyLabel = (
<>
<span className="icon">
<i className="fas fa-history" />
</span>
<span className="is-hidden-mobile">
{t("sources.content.historyButton")}
</span>
</>
);
return (
<ButtonGroup
firstlabel={sourcesLabel}
secondlabel={historyLabel}
firstColor=""
secondColor=""
firstAction={this.showSources}
secondAction={this.showHistory}
firstIsSelected={!historyIsSelected}
/>
);
}
}
export default translate("repos")(FileButtonGroup);