center download button

This commit is contained in:
Maren Süwer
2018-10-29 09:59:04 +01:00
parent 463a93553d
commit 866409c8df
2 changed files with 18 additions and 10 deletions

View File

@@ -7,14 +7,15 @@ import { DownloadButton } from "@scm-manager/ui-components";
type Props = { type Props = {
t: string => string, t: string => string,
file: File, file: File,
revision: string revision: string,
classes: any
}; };
class DownloadViewer extends React.Component<Props> { class DownloadViewer extends React.Component<Props> {
render() { render() {
const { t, file } = this.props; const { t, file } = this.props;
return ( return (
<div> <div className="has-text-centered">
<DownloadButton <DownloadButton
url={file._links.self.href} url={file._links.self.href}
displayName={t("sources.content.downloadButton")} displayName={t("sources.content.downloadButton")}

View File

@@ -14,10 +14,8 @@ import ImageViewer from "../components/content/ImageViewer";
import SourcecodeViewer from "../components/content/SourcecodeViewer"; import SourcecodeViewer from "../components/content/SourcecodeViewer";
import DownloadViewer from "../components/content/DownloadViewer"; import DownloadViewer from "../components/content/DownloadViewer";
import FileSize from "../components/FileSize"; import FileSize from "../components/FileSize";
import AvatarWrapper from "../../components/changesets/AvatarWrapper"; import injectSheet from "react-jss";
import classNames from "classnames"; import classNames from "classnames";
import AvatarImage from "../../components/changesets/AvatarImage";
import ChangesetAuthor from "../../components/changesets/ChangesetAuthor";
type Props = { type Props = {
t: string => string, t: string => string,
@@ -39,6 +37,12 @@ type State = {
hasError: boolean hasError: boolean
}; };
const styles = {
toCenterContent: {
display: "block"
}
};
class Content extends React.Component<Props, State> { class Content extends React.Component<Props, State> {
constructor(props: Props) { constructor(props: Props) {
super(props); super(props);
@@ -71,9 +75,8 @@ class Content extends React.Component<Props, State> {
} }
showHeader() { showHeader() {
const { file, revision, t } = this.props; const { file } = this.props;
const date = <DateFromNow date={file.lastModified} />; const date = <DateFromNow date={file.lastModified} />;
const fileSize = file.directory ? "" : <FileSize bytes={file.length} />;
return ( return (
<div className="content"> <div className="content">
@@ -110,7 +113,7 @@ class Content extends React.Component<Props, State> {
} }
render() { render() {
const { file } = this.props; const { file, classes } = this.props;
const error = this.state.error; const error = this.state.error;
const hasError = this.state.hasError; const hasError = this.state.hasError;
@@ -133,7 +136,9 @@ class Content extends React.Component<Props, State> {
<div className="media-content">{file.name}</div> <div className="media-content">{file.name}</div>
<div className="media-right">{fileSize}</div> <div className="media-right">{fileSize}</div>
</article> </article>
<div className="panel-block">{content}</div> <div className={classNames("panel-block", classes.toCenterContent)}>
{content}
</div>
</nav> </nav>
</div> </div>
); );
@@ -161,4 +166,6 @@ const mapStateToProps = (state: any, ownProps: Props) => {
}; };
}; };
export default connect(mapStateToProps)(translate("repos")(Content)); export default injectSheet(styles)(
connect(mapStateToProps)(translate("repos")(Content))
);