From dc7c27ec9c1ddfc6e9ce8741ee2ed615bb5ca035 Mon Sep 17 00:00:00 2001 From: Chad <36685920+chadbrokaw@users.noreply.github.com> Date: Tue, 16 Jul 2024 12:20:35 -0600 Subject: [PATCH] feat: improve menu flexibility (#152) --- src/headers/SiteHeader.scss | 15 ++++++++++ src/headers/SiteHeader.stories.tsx | 44 ++++++++++++++++++++++++++++++ src/headers/SiteHeader.tsx | 2 ++ 3 files changed, 61 insertions(+) diff --git a/src/headers/SiteHeader.scss b/src/headers/SiteHeader.scss index a700cb0..fbddfcd 100644 --- a/src/headers/SiteHeader.scss +++ b/src/headers/SiteHeader.scss @@ -433,6 +433,10 @@ padding-right: var(--bloom-s1); } +.site-header__dropdown-wrapper { + position: relative; +} + .site-header__navbar-wrapped { background-color: var(--wrapped-background-color); justify-content: flex-start; @@ -503,6 +507,17 @@ .site-header__dropdown { display: flex; flex-direction: column; + + &::before { + content: ""; + position: absolute; + top: -10px; + bottom: -20px; + left: -20px; + right: -20px; + z-index: -1; + pointer-events: auto; + } } .site-header__dropdown-item { diff --git a/src/headers/SiteHeader.stories.tsx b/src/headers/SiteHeader.stories.tsx index bdf6c84..f209012 100644 --- a/src/headers/SiteHeader.stories.tsx +++ b/src/headers/SiteHeader.stories.tsx @@ -1,6 +1,7 @@ import * as React from "react" import { SiteHeader } from "./SiteHeader" +import Icon from "../icons/Icon" export default { title: "Headers/Site Header", @@ -338,6 +339,49 @@ export const withDropdownIcons = () => ( ]} /> ) + +export const withDropdownIconElement = () => ( + console.log("Clicked English"), active: true }, + { label: "Español", onClick: () => console.log("Clicked Español"), active: false }, + { label: "中文", onClick: () => console.log("Clicked 中文"), active: false }, + ]} + notice="We're just getting started. We'd love to get your feedback." + logoSrc="/images/logo_glyph.svg" + title="Alameda County Housing Portal" + dropdownItemClassName={"text-2xs"} + menuLinks={[ + { + title: "My Account", + subMenuLinks: [ + { + title: "My Dashboard", + href: "/account/dashboard", + className: "text-[13px]", + iconElement: , + }, + { + title: "My Applications", + href: "/account/dashboard", + iconElement: , + }, + { + title: "Account Settings", + href: "/account/edit", + iconElement: , + }, + { + title: "Sign Out", + onClick: () => {}, + }, + ], + }, + ]} + /> +) + export const imageOnlyLogo = () => ( void subMenuLinks?: MenuLink[] @@ -122,6 +123,7 @@ const SiteHeader = (props: SiteHeaderProps) => { const dropdownOptionContent = (option: MenuLink) => { return ( <> + {option?.iconElement && isDesktop && option.iconElement} {option.iconSrc && isDesktop && (