added global navigation

This commit is contained in:
Maren Süwer
2018-08-09 10:18:12 +02:00
parent b03e058c6a
commit 4edf5d6f35
2 changed files with 67 additions and 4 deletions

View File

@@ -1,9 +1,53 @@
import React, { Component } from "react";
import React from "react";
import { translate } from "react-i18next";
import { Route } from "react-router";
import { Page } from "../../components/layout";
import { Navigation, NavLink, Section } from "../../components/navigation";
import GlobalConfig from "./GlobalConfig";
import type { History } from "history";
type Props = {
// context objects
t: string => string,
match: any,
history: History
};
class Config extends React.Component<Props> {
stripEndingSlash = (url: string) => {
if (url.endsWith("/")) {
return url.substring(0, url.length - 2);
}
return url;
};
matchedUrl = () => {
return this.stripEndingSlash(this.props.match.url);
};
class Config extends Component {
render() {
return <div>Here, Config will be shown</div>;
const { t } = this.props;
const url = this.matchedUrl();
return (
<Page title={t("config.title")}>
<div className="columns">
<div className="column is-three-quarters">
<Route path={url} exact component={() => <GlobalConfig />} />
</div>
<div className="column">
<Navigation>
<Section label={t("config.navigation-title")}>
<NavLink to={`${url}`} label={t("config.globalConfig-label")} />
</Section>
</Navigation>
</div>
</div>
</Page>
);
}
}
export default Config;
export default translate("config")(Config);