{toggleMobileMenu ? (
@@ -80,48 +101,11 @@ const LeftNav = ({
) : null}
- -
-
- "c-left-nav__link" +
- (isActive ? " c-left-nav__link--active" : "")
- }
- title="Route Ladders"
- to="/"
- >
-
- {collapsed ? null : "Route Ladders"}
-
-
- -
-
- "c-left-nav__link" +
- (isActive ? " c-left-nav__link--active" : "")
- }
- title="Shuttle Map"
- to="/shuttle-map"
- >
-
- {collapsed ? null : "Shuttle Map"}
-
-
- -
-
- "c-left-nav__link" +
- (isActive ? " c-left-nav__link--active" : "")
- }
- title={mapMode.title}
- to={mapMode.path}
- onClick={() => {
- mapMode.navEventText && fullStoryEvent(mapMode.navEventText, {})
- }}
- >
-
- {collapsed ? null : mapMode.title}
-
-
+ {navLinkData.map((linkData) => (
+ -
+
+
+ ))}
-
diff --git a/assets/src/navLinkData.ts b/assets/src/navLinkData.ts
new file mode 100644
index 000000000..bb2657f85
--- /dev/null
+++ b/assets/src/navLinkData.ts
@@ -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>
+
+export interface LinkData {
+ title: string
+ path: string
+ navIcon: React.JSXElementConstructor
+ 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, {})
+ },
+ },
+ ]
+}