mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 23:45:44 +01:00
replaced self-hacked™ solution with bulma panels for changesets
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import type { Branch } from "@scm-manager/ui-types";
|
import type { Branch } from "@scm-manager/ui-types";
|
||||||
import TableHeader from "./TableHeader";
|
|
||||||
import injectSheet from "react-jss";
|
import injectSheet from "react-jss";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import DropDown from "./forms/DropDown";
|
import DropDown from "./forms/DropDown";
|
||||||
@@ -13,6 +12,12 @@ const styles = {
|
|||||||
},
|
},
|
||||||
minWidthOfLabel: {
|
minWidthOfLabel: {
|
||||||
minWidth: "4.5rem"
|
minWidth: "4.5rem"
|
||||||
|
},
|
||||||
|
labelSizing: {
|
||||||
|
fontSize: "1rem !important"
|
||||||
|
},
|
||||||
|
noBottomMargin: {
|
||||||
|
marginBottom: "0 !important"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -35,7 +40,9 @@ class BranchSelector extends React.Component<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const selectedBranch = this.props.branches.find(branch => branch.name === this.props.selectedBranch);
|
const selectedBranch = this.props.branches.find(
|
||||||
|
branch => branch.name === this.props.selectedBranch
|
||||||
|
);
|
||||||
this.setState({ selectedBranch });
|
this.setState({ selectedBranch });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +51,13 @@ class BranchSelector extends React.Component<Props, State> {
|
|||||||
|
|
||||||
if (branches) {
|
if (branches) {
|
||||||
return (
|
return (
|
||||||
<TableHeader>
|
<div
|
||||||
|
className={classNames(
|
||||||
|
"field",
|
||||||
|
"is-horizontal",
|
||||||
|
classes.noBottomMargin
|
||||||
|
)}
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
"field-label",
|
"field-label",
|
||||||
@@ -53,10 +66,14 @@ class BranchSelector extends React.Component<Props, State> {
|
|||||||
classes.minWidthOfLabel
|
classes.minWidthOfLabel
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<label className="label">{label}</label>
|
<label className={classNames("label", classes.labelSizing)}>
|
||||||
|
{label}
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div className="field-body">
|
<div className="field-body">
|
||||||
<div className="field is-narrow">
|
<div
|
||||||
|
className={classNames("field is-narrow", classes.noBottomMargin)}
|
||||||
|
>
|
||||||
<div className="control">
|
<div className="control">
|
||||||
<DropDown
|
<DropDown
|
||||||
className="is-fullwidth"
|
className="is-fullwidth"
|
||||||
@@ -71,7 +88,7 @@ class BranchSelector extends React.Component<Props, State> {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</TableHeader>
|
</div>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
//@flow
|
|
||||||
import * as React from "react";
|
|
||||||
import classNames from "classnames";
|
|
||||||
import injectSheet from "react-jss";
|
|
||||||
|
|
||||||
type Props = {
|
|
||||||
children?: React.Node,
|
|
||||||
classes: Object
|
|
||||||
};
|
|
||||||
|
|
||||||
const styles = {
|
|
||||||
wrapper: {
|
|
||||||
padding: "1rem 1.5rem 0.25rem 1.5rem",
|
|
||||||
borderBottom: "1px solid #dbdbdb"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class TableHeader extends React.Component<Props> {
|
|
||||||
render() {
|
|
||||||
const { classes, children } = this.props;
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className={classNames(
|
|
||||||
"has-background-light field",
|
|
||||||
"is-horizontal",
|
|
||||||
classes.wrapper
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{children}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default injectSheet(styles)(TableHeader);
|
|
||||||
@@ -25,7 +25,6 @@ export { default as Tooltip } from "./Tooltip";
|
|||||||
export { getPageFromMatch } from "./urls";
|
export { getPageFromMatch } from "./urls";
|
||||||
export { default as Autocomplete} from "./Autocomplete";
|
export { default as Autocomplete} from "./Autocomplete";
|
||||||
export { default as BranchSelector } from "./BranchSelector";
|
export { default as BranchSelector } from "./BranchSelector";
|
||||||
export { default as TableHeader } from "./TableHeader";
|
|
||||||
|
|
||||||
export { apiClient, NOT_FOUND_ERROR, UNAUTHORIZED_ERROR, CONFLICT_ERROR } from "./apiclient.js";
|
export { apiClient, NOT_FOUND_ERROR, UNAUTHORIZED_ERROR, CONFLICT_ERROR } from "./apiclient.js";
|
||||||
|
|
||||||
|
|||||||
@@ -89,10 +89,12 @@ class BranchRoot extends React.Component<Props> {
|
|||||||
const changesets = <Changesets repository={repository} branch={branch} />;
|
const changesets = <Changesets repository={repository} branch={branch} />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="has-border-around is-round">
|
<nav className="panel">
|
||||||
|
<article className="panel-heading">
|
||||||
{this.renderBranchSelector()}
|
{this.renderBranchSelector()}
|
||||||
|
</article>
|
||||||
<Route path={`${url}/:page?`} component={() => changesets} />
|
<Route path={`${url}/:page?`} component={() => changesets} />
|
||||||
</div>
|
</nav>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user