Files
SCM-Manager/scm-ui/src/config/containers/Config.js

54 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-08-09 10:18:12 +02:00
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);
};
2018-08-09 09:38:55 +02:00
render() {
2018-08-09 10:18:12 +02:00
const { t } = this.props;
const url = this.matchedUrl();
return (
<Page>
2018-08-09 10:18:12 +02:00
<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")}>
2018-08-09 12:09:50 +02:00
<NavLink to={`${url}`} label={t("global-config.navigation-label")} />
2018-08-09 10:18:12 +02:00
</Section>
</Navigation>
</div>
</div>
</Page>
);
2018-08-09 09:38:55 +02:00
}
}
2018-08-09 10:18:12 +02:00
export default translate("config")(Config);