From 9a7c17edb5e570b5e3e92409f60c0a6c539188fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Pfeuffer?= Date: Wed, 19 Dec 2018 15:32:53 +0100 Subject: [PATCH] Correct merge --- scm-ui/src/repos/containers/BranchSelector.js | 199 ++++++++++-------- 1 file changed, 106 insertions(+), 93 deletions(-) diff --git a/scm-ui/src/repos/containers/BranchSelector.js b/scm-ui/src/repos/containers/BranchSelector.js index 3fbd67e451..03ee1b37f6 100644 --- a/scm-ui/src/repos/containers/BranchSelector.js +++ b/scm-ui/src/repos/containers/BranchSelector.js @@ -1,93 +1,106 @@ -// @flow - -import React from "react"; -import type { Branch } from "@scm-manager/ui-types"; -import DropDown from "../components/DropDown"; -import { translate } from "react-i18next"; -import injectSheet from "react-jss"; -import { compose } from "redux"; -import classNames from "classnames"; - -const styles = { - zeroflex: { - flexGrow: 0 - }, - minWidthOfLabel: { - minWidth: "4.5rem" - }, - wrapper: { - padding: "1rem 1.5rem 0.25rem 1.5rem", - border: "1px solid #eee", - borderRadius: "5px 5px 0 0" - } -}; - -type Props = { - branches: Branch[], // TODO: Use generics? - selected: (branch?: Branch) => void, - selectedBranch: string, - - // context props - classes: Object, - t: string => string -}; - -type State = { selectedBranch?: Branch }; - -class BranchSelector extends React.Component { - constructor(props: Props) { - super(props); - this.state = {}; - } - - componentDidMount() { - this.props.branches - .filter(branch => branch.name === this.props.selectedBranch) - .forEach(branch => this.setState({ selectedBranch: branch })); - } - - render() { - const { branches, classes, t } = this.props; - - if (branches) { - return ( -
-
- -
-
-
-
- b.name)} - optionSelected={this.branchSelected} - preselectedOption={ - this.state.selectedBranch - ? this.state.selectedBranch.name - : "" - } - /> -
-
-
-
- ); - } else { - return null; - } - } - - branchSelected = (branchName: string) => { - const { branches, selected } = this.props; - const branch = branches.find(b => b.name === branchName); - - selected(branch); - this.setState({ selectedBranch: branch }); - }; -} - -export default compose( - injectSheet(styles), - translate("repos") -)(BranchSelector); +// @flow + +import React from "react"; +import type { Branch } from "@scm-manager/ui-types"; +import DropDown from "../components/DropDown"; +import { translate } from "react-i18next"; +import injectSheet from "react-jss"; +import { compose } from "redux"; +import classNames from "classnames"; + +const styles = { + zeroflex: { + flexGrow: 0 + }, + minWidthOfLabel: { + minWidth: "4.5rem" + }, + wrapper: { + padding: "1rem 1.5rem 0.25rem 1.5rem", + border: "1px solid #eee", + borderRadius: "5px 5px 0 0" + } +}; + +type Props = { + branches: Branch[], // TODO: Use generics? + selected: (branch?: Branch) => void, + selectedBranch: string, + + // context props + classes: Object, + t: string => string +}; + +type State = { selectedBranch?: Branch }; + +class BranchSelector extends React.Component { + constructor(props: Props) { + super(props); + this.state = {}; + } + + componentDidMount() { + this.props.branches + .filter(branch => branch.name === this.props.selectedBranch) + .forEach(branch => this.setState({ selectedBranch: branch })); + } + + render() { + const { branches, classes, t } = this.props; + + if (branches) { + return ( +
+
+ +
+
+
+
+ b.name)} + optionSelected={this.branchSelected} + preselectedOption={ + this.state.selectedBranch + ? this.state.selectedBranch.name + : "" + } + /> +
+
+
+
+ ); + } else { + return null; + } + } + + branchSelected = (branchName: string) => { + const { branches, selected } = this.props; + const branch = branches.find(b => b.name === branchName); + + selected(branch); + this.setState({ selectedBranch: branch }); + }; +} + +export default compose( + injectSheet(styles), + translate("repos") +)(BranchSelector);