mirror of https://github.com/ethereum/go-ethereum
[UX SUGGESTION] Active section should be expanded on docs page load (#190)
* Add functionality to have left navbar section open on page load * remove tracker as prop Co-authored-by: Paul Wackerow <54227730+wackerow@users.noreply.github.com>pull/26374/head
parent
82a633c299
commit
e60ec269ba
@ -0,0 +1,22 @@ |
|||||||
|
import { NavLink } from '../types'; |
||||||
|
|
||||||
|
interface Props { |
||||||
|
to?: string; |
||||||
|
items?: NavLink[]; |
||||||
|
pathCheck: string; |
||||||
|
} |
||||||
|
export const checkNavLinks = ({ to, items, pathCheck }: Props): boolean => { |
||||||
|
let tracker = false; |
||||||
|
|
||||||
|
if (to === pathCheck) { |
||||||
|
tracker = true; |
||||||
|
} |
||||||
|
|
||||||
|
items?.forEach(({ to, items }) => { |
||||||
|
if (checkNavLinks({ to, items, pathCheck })) { |
||||||
|
tracker = true; |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
return tracker; |
||||||
|
}; |
Loading…
Reference in new issue