mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-15 17:56:17 +01:00
allow navlink to be active at other links
This commit is contained in:
@@ -7,7 +7,8 @@ import { Route, Link } from "react-router-dom";
|
|||||||
type Props = {
|
type Props = {
|
||||||
to: string,
|
to: string,
|
||||||
label: string,
|
label: string,
|
||||||
activeOnlyWhenExact?: boolean
|
activeOnlyWhenExact?: boolean,
|
||||||
|
otherLocation: (route: any) => boolean
|
||||||
};
|
};
|
||||||
|
|
||||||
class NavLink extends React.Component<Props> {
|
class NavLink extends React.Component<Props> {
|
||||||
@@ -16,10 +17,10 @@ class NavLink extends React.Component<Props> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
renderLink = (route: any) => {
|
renderLink = (route: any) => {
|
||||||
const { to, label } = this.props;
|
const { to, label, otherLocation } = this.props;
|
||||||
return (
|
return (
|
||||||
<li>
|
<li>
|
||||||
<Link className={route.match ? "is-active" : ""} to={to}>
|
<Link className={route.match || (otherLocation && otherLocation(route)) ? "is-active" : ""} to={to}>
|
||||||
{label}
|
{label}
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user