Merged in feature/unify_table (pull request #175)

Feature/unify table
This commit is contained in:
Florian Scholdei
2019-02-06 14:11:24 +00:00
10 changed files with 119 additions and 72 deletions

View File

@@ -13,10 +13,11 @@ const styles = {
minWidthOfLabel: { minWidthOfLabel: {
minWidth: "4.5rem" minWidth: "4.5rem"
}, },
wrapper: { labelSizing: {
padding: "1rem 1.5rem 0.25rem 1.5rem", fontSize: "1rem !important"
border: "1px solid #eee", },
borderRadius: "5px 5px 0 0" noBottomMargin: {
marginBottom: "0 !important"
} }
}; };
@@ -52,9 +53,9 @@ class BranchSelector extends React.Component<Props, State> {
return ( return (
<div <div
className={classNames( className={classNames(
"has-background-light field", "field",
"is-horizontal", "is-horizontal",
classes.wrapper classes.noBottomMargin
)} )}
> >
<div <div
@@ -65,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"

View File

@@ -21,7 +21,7 @@ class ChangesetList extends React.Component<Props> {
/> />
); );
}); });
return <div className="box">{content}</div>; return <>{content}</>;
} }
} }

View File

@@ -2,7 +2,12 @@
import React from "react"; import React from "react";
import { withRouter } from "react-router-dom"; import { withRouter } from "react-router-dom";
import type {Branch, Changeset, PagedCollection, Repository} from "@scm-manager/ui-types"; import type {
Branch,
Changeset,
PagedCollection,
Repository
} from "@scm-manager/ui-types";
import { import {
fetchChangesets, fetchChangesets,
getChangesets, getChangesets,
@@ -12,7 +17,13 @@ import {
} from "../modules/changesets"; } from "../modules/changesets";
import { connect } from "react-redux"; import { connect } from "react-redux";
import {ErrorNotification, getPageFromMatch, LinkPaginator, ChangesetList, Loading} from "@scm-manager/ui-components"; import {
ErrorNotification,
getPageFromMatch,
LinkPaginator,
ChangesetList,
Loading
} from "@scm-manager/ui-components";
import { compose } from "redux"; import { compose } from "redux";
type Props = { type Props = {
@@ -64,13 +75,21 @@ class Changesets extends React.Component<Props> {
renderList = () => { renderList = () => {
const { repository, changesets } = this.props; const { repository, changesets } = this.props;
return <ChangesetList repository={repository} changesets={changesets} />; return (
<div className="panel-block">
<ChangesetList repository={repository} changesets={changesets} />
</div>
);
}; };
renderPaginator = () => { renderPaginator = () => {
const { page, list } = this.props; const { page, list } = this.props;
if (list) { if (list) {
return <LinkPaginator page={page} collection={list} />; return (
<div className="panel-footer">
<LinkPaginator page={page} collection={list} />
</div>
);
} }
return null; return null;
}; };

View File

@@ -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="panel">
<div className="panel-heading">
{this.renderBranchSelector()} {this.renderBranchSelector()}
</div>
<Route path={`${url}/:page?`} component={() => changesets} /> <Route path={`${url}/:page?`} component={() => changesets} />
</> </div>
); );
} }

View File

@@ -108,6 +108,7 @@ class FileTree extends React.Component<Props> {
} }
return ( return (
<div className="panel-block">
<table className="table table-hover table-sm is-fullwidth"> <table className="table table-hover table-sm is-fullwidth">
<thead> <thead>
<tr> <tr>
@@ -134,6 +135,7 @@ class FileTree extends React.Component<Props> {
))} ))}
</tbody> </tbody>
</table> </table>
</div>
); );
} }
} }

View File

@@ -29,9 +29,6 @@ type State = {
}; };
const styles = { const styles = {
toCenterContent: {
display: "block"
},
pointer: { pointer: {
cursor: "pointer" cursor: "pointer"
}, },
@@ -126,7 +123,6 @@ class Content extends React.Component<Props, State> {
<div <div
className={classNames( className={classNames(
"panel-block", "panel-block",
classes.toCenterContent,
classes.hasBackground classes.hasBackground
)} )}
> >
@@ -161,7 +157,7 @@ class Content extends React.Component<Props, State> {
} }
render() { render() {
const { file, revision, repository, path, classes } = this.props; const { file, revision, repository, path } = this.props;
const { showHistory } = this.state; const { showHistory } = this.state;
const header = this.showHeader(); const header = this.showHeader();
@@ -180,13 +176,11 @@ class Content extends React.Component<Props, State> {
return ( return (
<div> <div>
<nav className="panel"> <div className="panel">
<article className="panel-heading">{header}</article> <div className="panel-heading">{header}</div>
{moreInformation} {moreInformation}
<div className={classNames("panel-block", classes.toCenterContent)}>
{content} {content}
</div> </div>
</nav>
</div> </div>
); );
} }

View File

@@ -79,12 +79,16 @@ class HistoryView extends React.Component<Props, State> {
const currentPage = page + 1; const currentPage = page + 1;
return ( return (
<> <>
<div className="panel-block">
<ChangesetList repository={repository} changesets={changesets} /> <ChangesetList repository={repository} changesets={changesets} />
</div>
<div className="panel-footer">
<StatePaginator <StatePaginator
page={currentPage} page={currentPage}
collection={pageCollection} collection={pageCollection}
updatePage={(newPage: number) => this.updatePage(newPage)} updatePage={(newPage: number) => this.updatePage(newPage)}
/> />
</div>
</> </>
); );
} }

View File

@@ -93,8 +93,10 @@ class Sources extends React.Component<Props> {
if (currentFileIsDirectory) { if (currentFileIsDirectory) {
return ( return (
<div className={"has-border-around"}> <div className="panel">
<div className="panel-heading">
{this.renderBranchSelector()} {this.renderBranchSelector()}
</div>
<FileTree <FileTree
repository={repository} repository={repository}
revision={revision} revision={revision}

View File

@@ -90,7 +90,7 @@ class SourcesView extends React.Component<Props, State> {
const sources = this.showSources(); const sources = this.showSources();
return <>{sources}</>; return <div className="panel-block">{sources}</div>;
} }
} }

View File

@@ -94,14 +94,6 @@ $fa-font-path: "webfonts";
} }
} }
//border around options
.has-border-around {
border-top: 1px solid #eee;
border-left: 1px solid #eee;
border-right: 1px solid #eee;
border-bottom: 1px solid #eee;
}
// multiline Columns // multiline Columns
.columns.is-multiline { .columns.is-multiline {
.column.is-half { .column.is-half {
@@ -201,6 +193,33 @@ $fa-font-path: "webfonts";
} }
} }
// panels
.panel {
.panel-heading > .field {
margin-bottom: 0; // replace selector margin
}
.panel-block {
display: block;
}
.panel-footer {
background-color: whitesmoke;
border-radius: 0 0 4px 4px;
color: #363636;
font-size: 1.25em;
font-weight: 300;
line-height: 1.25;
padding: 0.5em 0.75em;
border-left: 1px solid #dbdbdb;
border-right: 1px solid #dbdbdb;
&:last-child {
border-bottom: 1px solid #dbdbdb;
}
}
}
// forms // forms
.field:not(.is-grouped) { .field:not(.is-grouped) {
margin-bottom: 1rem; margin-bottom: 1rem;