-
-
+
+
+
+
+
+
+ {siteSettingsConfig && siteSettingsConfig.sumSiteHeaderPrim && }
+ {siteSettingsConfig && siteSettingsConfig.sumSiteHeaderSec && }
+
+
-
-
+
)
diff --git a/src/components/menu/main-menu.tsx b/src/components/menu/main-menu.tsx
index 62a8cdc8..019c51d2 100644
--- a/src/components/menu/main-menu.tsx
+++ b/src/components/menu/main-menu.tsx
@@ -4,12 +4,20 @@ import Link from "@components/elements/link";
import SiteSearchForm from "@components/search/site-search-form";
import useActiveTrail from "@lib/hooks/useActiveTrail";
import useOutsideClick from "@lib/hooks/useOutsideClick";
-import {ChevronDownIcon} from "@heroicons/react/20/solid";
-import {MenuItem as MenuItemType} from "@lib/gql/__generated__/drupal.d";
-import {clsx} from "clsx";
-import {useBoolean, useEventListener} from "usehooks-ts";
-import {useCallback, useEffect, useId, useLayoutEffect, useRef, useState} from "react";
-import {usePathname} from "next/navigation";
+import { ArrowRightIcon, ChevronDownIcon, MagnifyingGlassIcon } from "@heroicons/react/20/solid";
+import { MenuItem as MenuItemType, StanfordBasicSiteSetting } from "@lib/gql/__generated__/drupal.d";
+import { clsx } from "clsx";
+import { useBoolean, useEventListener } from "usehooks-ts";
+import {
+ useCallback,
+ useEffect,
+ useId,
+ useLayoutEffect,
+ useRef,
+ useState,
+} from "react";
+import { usePathname } from "next/navigation";
+import Button from "@components/elements/button";
const menuLevelsToShow = 2;
@@ -17,68 +25,132 @@ type Props = {
/**
* Array of nested menu items.
*/
- menuItems: MenuItemType[]
-}
+ menuItems: MenuItemType[];
+ sumSiteHeaderPrim?: StanfordBasicSiteSetting["sumSiteHeaderPrim"];
+ sumSiteHeaderSec?: StanfordBasicSiteSetting["sumSiteHeaderSec"];
+};
-const MainMenu = ({menuItems}: Props) => {
- const buttonRef = useRef
(null)
+const MainMenu = ({ menuItems, sumSiteHeaderPrim, sumSiteHeaderSec}: Props) => {
+ const buttonRef = useRef(null);
const menuRef = useRef(null);
const navId = useId();
- const {value: menuOpen, setFalse: closeMenu, toggle: toggleMenu} = useBoolean(false)
- const browserUrl = usePathname()
+ const { value: menuOpen, setFalse: closeMenu, toggle: toggleMenu } = useBoolean(false);
+ const browserUrl = usePathname();
const activeTrail = useActiveTrail(menuItems, usePathname() || "");
useOutsideClick(menuRef, closeMenu);
- const handleEscape = useCallback((event: KeyboardEvent) => {
- if (event.key !== "Escape" || !menuOpen) return;
+ const handleEscape = useCallback(
+ (event: KeyboardEvent) => {
+ if (event.key !== "Escape" || !menuOpen) return;
- closeMenu()
- buttonRef.current?.focus();
- }, [menuOpen, closeMenu]);
+ closeMenu();
+ buttonRef.current?.focus();
+ },
+ [menuOpen, closeMenu]
+ );
useEffect(() => closeMenu(), [browserUrl, closeMenu]);
useEventListener("keydown", handleEscape, menuRef);
return (
-