Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update header component to take additional actions (#560) #561

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import { SocialMedia } from "./entities";
export function flattenMoreLink(links: NavLinkItem[]): NavLinkItem[] {
return links.flatMap((link: NavLinkItem) => {
if (link.label === HEADER_NAVIGATION_LABEL.MORE) {
if (link.flatten === false) {
return link;
}
return link.menuItems as NavLinkItem[];
}
return link;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Authentication } from "../../../Authentication/authentication";
import { Search } from "../../../Search/search";

export interface DialogTitleProps {
actions?: ReactNode;
Announcements?: ReactNode;
authenticationEnabled?: boolean;
Logo?: ReactNode;
Expand All @@ -15,6 +16,7 @@ export interface DialogTitleProps {
}

export const Toolbar = ({
actions,
Announcements,
authenticationEnabled,
Logo,
Expand All @@ -39,6 +41,8 @@ export const Toolbar = ({
authenticationEnabled={authenticationEnabled}
closeMenu={onClose}
/>
{/* Additional actions i.e. call-to-action button */}
{actions}
{/* Close menu */}
<IconButton color="ink" onClick={onClose}>
<CloseRoundedIcon />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { Socials } from "./components/Content/components/Socials/socials.styles"
import { AppBar as HeaderAppBar, HeaderSmAppBar } from "./header.styles";

export interface HeaderProps {
actions?: ReactNode;
Announcements?: ReactNode;
authenticationEnabled?: boolean;
className?: string;
Expand All @@ -54,6 +55,7 @@ export const Header = ({ ...headerProps }: HeaderProps): JSX.Element => {
const {
Announcements,
authenticationEnabled,
actions,
className,
Logo,
navAlignment = ELEMENT_ALIGNMENT.LEFT,
Expand Down Expand Up @@ -160,6 +162,8 @@ export const Header = ({ ...headerProps }: HeaderProps): JSX.Element => {
authenticationEnabled={authenticationEnabled}
closeMenu={closeMenu}
/>
{/* Additional actions i.e. call-to-action button */}
{actions}
{/* Menu */}
<Menu
closeMenu={closeMenu}
Expand Down
Loading