@payfit/unity-components
Version:
58 lines (57 loc) • 2.34 kB
JavaScript
import { isMobileBreakpoint as e, useBreakpointListener as t } from "../../../hooks/use-breakpoint-listener.js";
import { Button as n } from "../../button/Button.js";
import { useAppMenuContext as r } from "./AppMenu.context.js";
import { PayFitBrand as i } from "../../payfit-brand/PayFitBrand.js";
import { PayFitBrandPreprod as a } from "../../payfit-brand/PayFitPreprod.js";
import { useMemo as o } from "react";
import { useUnityTheme as s } from "@payfit/unity-themes";
import { jsx as c, jsxs as l } from "react/jsx-runtime";
import { useIntl as u } from "react-intl";
import { Link as d } from "react-aria-components/Link";
//#region src/components/app-menu/parts/AppMenuHeader.tsx
var f = ({ environment: f, brandLabel: p, notificationsComponent: m, searchComponent: h, renderLink: g = ({ children: e }) => /* @__PURE__ */ c(d, {
href: "/",
children: e
}) }) => {
let { isMobileMenuOpen: _, toggleMobileMenu: v } = r(), { theme: y } = s(), b = u(), x = e(t()), S = o(() => y === "rebrand" ? x ? 36 : 78 : x ? 36 : 104, [x, y]);
return /* @__PURE__ */ l("header", {
className: "uy:flex uy:shrink-0 uy:flex-col uy:gap-y-200 uy:pl-25 uy:pr-25",
children: [/* @__PURE__ */ l("div", {
className: "uy:flex uy:items-center",
children: [/* @__PURE__ */ c("div", {
className: "uy:flex-1",
children: g({ children: f === "prod" ? /* @__PURE__ */ c(i, {
label: p,
width: S,
showOnlyMonogram: x
}) : /* @__PURE__ */ c(a, {
label: p,
env: f,
showOnlyMonogram: x
}) })
}), /* @__PURE__ */ l("div", {
className: "uy:flex uy:gap-150 uy:items-center",
children: [m, /* @__PURE__ */ c("div", {
className: "uy:block uy:md:hidden",
children: /* @__PURE__ */ c(n, {
variant: "ghost",
color: "neutral",
prefixIcon: _ ? "CloseOutlined" : "ListOutlined",
onPress: v,
"aria-expanded": _,
"aria-controls": "app-menu-nav-container app-menu-profile-button",
children: b.formatMessage({
id: _ ? "unity:component:app-menu:header:menu-close" : "unity:component:app-menu:header:menu-open",
defaultMessage: _ ? "Close navigation" : "Open navigation"
})
})
})]
})]
}), /* @__PURE__ */ c("div", {
className: "uy:hidden uy:md:flex",
children: h
})]
});
};
//#endregion
export { f as AppMenuHeader };