@payfit/unity-components
Version:
62 lines (61 loc) • 2.44 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, helpComponent: m, notificationsComponent: h, searchComponent: g, renderLink: _ = ({ children: e }) => /* @__PURE__ */ c(d, {
href: "/",
children: e
}) }) => {
let { isMobileMenuOpen: v, toggleMobileMenu: y } = r(), { theme: b } = s(), x = u(), S = e(t()), C = S && v, w = o(() => b === "rebrand" ? S ? 36 : 78 : S ? 36 : 104, [S, b]);
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 uy:justify-between",
children: [/* @__PURE__ */ c("div", {
className: "uy:flex-0",
children: _({ children: f === "prod" ? /* @__PURE__ */ c(i, {
label: p,
width: w,
showOnlyMonogram: S
}) : /* @__PURE__ */ c(a, {
label: p,
env: f,
showOnlyMonogram: S
}) })
}), /* @__PURE__ */ l("div", {
className: "uy:flex uy:gap-150 uy:items-center",
children: [
C ? m : null,
h,
/* @__PURE__ */ c("div", {
className: "uy:block uy:md:hidden",
children: /* @__PURE__ */ c(n, {
variant: "ghost",
color: "neutral",
prefixIcon: v ? "CloseOutlined" : "ListOutlined",
onPress: y,
"aria-expanded": v,
"aria-controls": "app-menu-nav-container app-menu-profile-button",
children: x.formatMessage({
id: v ? "unity:component:app-menu:header:menu-close" : "unity:component:app-menu:header:menu-open",
defaultMessage: v ? "Close navigation" : "Open navigation"
})
})
})
]
})]
}), /* @__PURE__ */ c("div", {
className: "uy:hidden uy:md:flex",
children: g
})]
});
};
//#endregion
export { f as AppMenuHeader };