mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-06 13:35:44 +01:00
used new Component
This commit is contained in:
@@ -21,9 +21,9 @@ class ButtonGroup extends React.Component<Props> {
|
|||||||
let showSecondColor = secondColor;
|
let showSecondColor = secondColor;
|
||||||
|
|
||||||
if (firstIsSelected) {
|
if (firstIsSelected) {
|
||||||
showFirstColor += " is-selected";
|
showFirstColor += "link is-selected";
|
||||||
} else {
|
} else {
|
||||||
showSecondColor += " is-selected";
|
showSecondColor += "link is-selected";
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ export { default as Button } from "./Button.js";
|
|||||||
export { default as CreateButton } from "./CreateButton.js";
|
export { default as CreateButton } from "./CreateButton.js";
|
||||||
export { default as DeleteButton } from "./DeleteButton.js";
|
export { default as DeleteButton } from "./DeleteButton.js";
|
||||||
export { default as EditButton } from "./EditButton.js";
|
export { default as EditButton } from "./EditButton.js";
|
||||||
export { default as RemoveEntryOfTableButton } from "./RemoveEntryOfTableButton.js";
|
|
||||||
export { default as SubmitButton } from "./SubmitButton.js";
|
export { default as SubmitButton } from "./SubmitButton.js";
|
||||||
export {default as DownloadButton} from "./DownloadButton.js";
|
export { default as DownloadButton } from "./DownloadButton.js";
|
||||||
|
export { default as ButtonGroup } from "./ButtonGroup.js";
|
||||||
|
export {
|
||||||
|
default as RemoveEntryOfTableButton
|
||||||
|
} from "./RemoveEntryOfTableButton.js";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { translate } from "react-i18next";
|
import { translate } from "react-i18next";
|
||||||
import { Button } from "@scm-manager/ui-components";
|
import { ButtonGroup } from "@scm-manager/ui-components";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
t: string => string,
|
t: string => string,
|
||||||
@@ -9,7 +9,7 @@ type Props = {
|
|||||||
showHistory: boolean => void
|
showHistory: boolean => void
|
||||||
};
|
};
|
||||||
|
|
||||||
class ButtonGroup extends React.Component<Props> {
|
class FileButtonGroup extends React.Component<Props> {
|
||||||
showHistory = () => {
|
showHistory = () => {
|
||||||
this.props.showHistory(true);
|
this.props.showHistory(true);
|
||||||
};
|
};
|
||||||
@@ -21,15 +21,6 @@ class ButtonGroup extends React.Component<Props> {
|
|||||||
render() {
|
render() {
|
||||||
const { t, historyIsSelected } = this.props;
|
const { t, historyIsSelected } = this.props;
|
||||||
|
|
||||||
let sourcesColor = "";
|
|
||||||
let historyColor = "";
|
|
||||||
|
|
||||||
if (historyIsSelected) {
|
|
||||||
historyColor = "link is-selected";
|
|
||||||
} else {
|
|
||||||
sourcesColor = "link is-selected";
|
|
||||||
}
|
|
||||||
|
|
||||||
const sourcesLabel = (
|
const sourcesLabel = (
|
||||||
<>
|
<>
|
||||||
<span className="icon">
|
<span className="icon">
|
||||||
@@ -53,20 +44,17 @@ class ButtonGroup extends React.Component<Props> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="buttons has-addons">
|
<ButtonGroup
|
||||||
<Button
|
firstlabel={sourcesLabel}
|
||||||
label={sourcesLabel}
|
secondlabel={historyLabel}
|
||||||
color={sourcesColor}
|
firstColor=""
|
||||||
action={this.showSources}
|
secondColor=""
|
||||||
|
firstAction={this.showSources}
|
||||||
|
secondAction={this.showHistory}
|
||||||
|
firstIsSelected={!historyIsSelected}
|
||||||
/>
|
/>
|
||||||
<Button
|
|
||||||
label={historyLabel}
|
|
||||||
color={historyColor}
|
|
||||||
action={this.showHistory}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translate("repos")(ButtonGroup);
|
export default translate("repos")(FileButtonGroup);
|
||||||
@@ -6,7 +6,7 @@ import { DateFromNow } from "@scm-manager/ui-components";
|
|||||||
import FileSize from "../components/FileSize";
|
import FileSize from "../components/FileSize";
|
||||||
import injectSheet from "react-jss";
|
import injectSheet from "react-jss";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import ButtonGroup from "../components/content/ButtonGroup";
|
import FileButtonGroup from "../components/content/FileButtonGroup";
|
||||||
import SourcesView from "./SourcesView";
|
import SourcesView from "./SourcesView";
|
||||||
import HistoryView from "./HistoryView";
|
import HistoryView from "./HistoryView";
|
||||||
import { getSources } from "../modules/sources";
|
import { getSources } from "../modules/sources";
|
||||||
@@ -76,7 +76,7 @@ class Content extends React.Component<Props, State> {
|
|||||||
const icon = collapsed ? "fa-angle-right" : "fa-angle-down";
|
const icon = collapsed ? "fa-angle-right" : "fa-angle-down";
|
||||||
|
|
||||||
const selector = file._links.history ? (
|
const selector = file._links.history ? (
|
||||||
<ButtonGroup
|
<FileButtonGroup
|
||||||
file={file}
|
file={file}
|
||||||
historyIsSelected={showHistory}
|
historyIsSelected={showHistory}
|
||||||
showHistory={(changeShowHistory: boolean) =>
|
showHistory={(changeShowHistory: boolean) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user