2018-11-26 15:20:44 +01:00
|
|
|
// @flow
|
|
|
|
|
import React from "react";
|
|
|
|
|
import { translate } from "react-i18next";
|
2019-01-29 14:02:36 +01:00
|
|
|
import { ButtonGroup } from "@scm-manager/ui-components";
|
2018-11-26 15:20:44 +01:00
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
t: string => string,
|
|
|
|
|
historyIsSelected: boolean,
|
|
|
|
|
showHistory: boolean => void
|
|
|
|
|
};
|
|
|
|
|
|
2019-01-29 14:02:36 +01:00
|
|
|
class FileButtonGroup extends React.Component<Props> {
|
2018-11-26 15:20:44 +01:00
|
|
|
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 (
|
2019-01-29 14:02:36 +01:00
|
|
|
<ButtonGroup
|
|
|
|
|
firstlabel={sourcesLabel}
|
|
|
|
|
secondlabel={historyLabel}
|
|
|
|
|
firstAction={this.showSources}
|
|
|
|
|
secondAction={this.showHistory}
|
|
|
|
|
firstIsSelected={!historyIsSelected}
|
|
|
|
|
/>
|
2018-11-26 15:20:44 +01:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-29 14:02:36 +01:00
|
|
|
export default translate("repos")(FileButtonGroup);
|