updates root components structure

This commit is contained in:
Christoph Wolfes
2018-07-25 14:29:43 +02:00
parent 7b921da174
commit 7b37e4e9b6
34 changed files with 38 additions and 29 deletions

View File

@@ -0,0 +1,29 @@
//@flow
import * as React from "react";
import { Route, Link } from "react-router-dom";
type Props = {
to: string,
label: string,
activeOnlyWhenExact?: boolean
};
class PrimaryNavigationLink extends React.Component<Props> {
renderLink = (route: any) => {
const { to, label } = this.props;
return (
<li className={route.match ? "is-active" : ""}>
<Link to={to}>{label}</Link>
</li>
);
};
render() {
const { to, activeOnlyWhenExact } = this.props;
return (
<Route path={to} exact={activeOnlyWhenExact} children={this.renderLink} />
);
}
}
export default PrimaryNavigationLink;