-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(assets/nav): Separate nav data from nav rendering (#2340)
* refactor(assets/nav): Separate data and rendering for left-nav components * refactor(assets/nav): Move nav data to its own file * refactor(assets/nav): Update bottom nav mobile to use nav link data
- Loading branch information
1 parent
33fc966
commit 6d503e0
Showing
3 changed files
with
94 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React from "react" | ||
import { mapModeForUser } from "./util/mapMode" | ||
import { fullStoryEvent } from "./helpers/fullStory" | ||
import { LadderIcon, MapIcon } from "./helpers/icon" | ||
|
||
type HTMLElementProps = React.PropsWithoutRef<React.HTMLAttributes<HTMLElement>> | ||
|
||
export interface LinkData { | ||
title: string | ||
path: string | ||
navIcon: React.JSXElementConstructor<HTMLElementProps> | ||
onClick?: () => void | ||
} | ||
|
||
export const getNavLinkData: () => LinkData[] = () => { | ||
const mapMode = mapModeForUser() | ||
|
||
return [ | ||
{ | ||
title: "Route Ladders", | ||
path: "/", | ||
navIcon: LadderIcon, | ||
}, | ||
{ | ||
title: "Shuttle Map", | ||
path: "/shuttle-map", | ||
navIcon: MapIcon, | ||
}, | ||
{ | ||
title: mapMode.title, | ||
path: mapMode.path, | ||
navIcon: mapMode.navIcon, | ||
onClick: () => { | ||
mapMode.navEventText && fullStoryEvent(mapMode.navEventText, {}) | ||
}, | ||
}, | ||
] | ||
} |