Skip to content

Commit

Permalink
feat: improve menu flexibility (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
chadbrokaw authored Jul 16, 2024
1 parent 5d21218 commit dc7c27e
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/headers/SiteHeader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
44 changes: 44 additions & 0 deletions src/headers/SiteHeader.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from "react"

import { SiteHeader } from "./SiteHeader"
import Icon from "../icons/Icon"

export default {
title: "Headers/Site Header",
Expand Down Expand Up @@ -338,6 +339,49 @@ export const withDropdownIcons = () => (
]}
/>
)

export const withDropdownIconElement = () => (
<SiteHeader
homeURL={"/"}
languages={[
{ label: "English", onClick: () => 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: <Icon symbol="profile" size="medium" className="pr-2" />,
},
{
title: "My Applications",
href: "/account/dashboard",
iconElement: <Icon symbol="application" size="medium" className="pr-2" />,
},
{
title: "Account Settings",
href: "/account/edit",
iconElement: <Icon symbol="settings" size="medium" className="pr-2" />,
},
{
title: "Sign Out",
onClick: () => {},
},
],
},
]}
/>
)

export const imageOnlyLogo = () => (
<SiteHeader
homeURL={"/"}
Expand Down
2 changes: 2 additions & 0 deletions src/headers/SiteHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface MenuLink {
className?: string
href?: string
iconClassName?: string
iconElement?: React.ReactNode
iconSrc?: string
onClick?: () => void
subMenuLinks?: MenuLink[]
Expand Down Expand Up @@ -122,6 +123,7 @@ const SiteHeader = (props: SiteHeaderProps) => {
const dropdownOptionContent = (option: MenuLink) => {
return (
<>
{option?.iconElement && isDesktop && option.iconElement}
{option.iconSrc && isDesktop && (
<img
src={option.iconSrc}
Expand Down

0 comments on commit dc7c27e

Please sign in to comment.