import cx from "classnames";
import React from "react";
import { BrandMark } from "./BrandMark";
import {
CLASS_CONTAINER,
CLASS_MOBILE,
CLASS_MOBILE_OVERLAY,
CLASS_MOBILE_WRAPPER,
CLASS_NAV_BUTTON,
CLASS_NAV_DROPDOWN,
CLASS_NAV_LOGO,
} from "./constants";
import { Logo } from "./Logo";
import { MegamenuIcon } from "./MegaMenuIcon";
import { MegamenuSearchContent } from "./MegamenuSearchContent";
export type MegamenuSearchState = {
hasSearchEmpty: boolean;
hasSearchFilled: boolean;
showSearchState: boolean;
searchValue: string;
};
type MegamenuLogoLinkProps = {
compactLogoOnly?: boolean;
href?: string;
title: string;
children?: React.ReactNode;
};
type MegamenuSearchDropdownProps = {
dropdownId: string;
inputId: string;
inputLabel: string;
searchValue: string;
hasSearchEmpty: boolean;
hasSearchFilled: boolean;
emptyStateLinkHref?: string;
};
type MegamenuCloseButtonProps = {
ariaLabel: string;
target: string;
};
type MegamenuMobilePanelProps = {
titleId: string;
panelId?: string;
target: string;
title: React.ReactNode;
overlayAriaLabel: string;
children: React.ReactNode;
};
export const getMegamenuSearchState = (
searchEmpty?: boolean,
searchFilled?: boolean,
): MegamenuSearchState => {
const hasSearchEmpty = Boolean(searchEmpty);
const hasSearchFilled = Boolean(searchFilled);
return {
hasSearchEmpty,
hasSearchFilled,
showSearchState: hasSearchEmpty || hasSearchFilled,
searchValue: hasSearchEmpty ? "" : hasSearchFilled ? "apple" : "",
};
};
export const MegamenuLogoLink = ({
compactLogoOnly = false,
href = "/",
title,
children,
}: MegamenuLogoLinkProps) => (
{compactLogoOnly ?