@payfit/unity-components
Version:
61 lines (60 loc) • 2.32 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 { jsx as s, jsxs as c } from "react/jsx-runtime";
import { useIntl as l } from "react-intl";
import { Link as u } from "react-aria-components/Link";
//#region src/components/app-menu/parts/AppMenuHeader.tsx
var d = ({ environment: d, brandLabel: f, helpComponent: p, notificationsComponent: m, searchComponent: h, renderLink: g = ({ children: e }) => /* @__PURE__ */ s(u, {
href: "/",
children: e
}) }) => {
let { isMobileMenuOpen: _, toggleMobileMenu: v } = r(), y = l(), b = e(t()), x = b && _, S = o(() => b ? 36 : 78, [b]);
return /* @__PURE__ */ c("header", {
className: "uy:flex uy:shrink-0 uy:flex-col uy:gap-y-200 uy:pl-25 uy:pr-25",
children: [/* @__PURE__ */ c("div", {
className: "uy:flex uy:items-center uy:justify-between",
children: [/* @__PURE__ */ s("div", {
className: "uy:flex-0",
children: g({ children: d === "prod" ? /* @__PURE__ */ s(i, {
label: f,
width: S,
showOnlyMonogram: b
}) : /* @__PURE__ */ s(a, {
label: f,
env: d,
showOnlyMonogram: b
}) })
}), /* @__PURE__ */ c("div", {
className: "uy:flex uy:gap-150 uy:items-center",
children: [
x ? p : null,
m,
/* @__PURE__ */ s("div", {
className: "uy:block uy:md:hidden",
children: /* @__PURE__ */ s(n, {
variant: "ghost",
color: "neutral",
prefixIcon: _ ? "CloseOutlined" : "ListOutlined",
onPress: v,
"aria-expanded": _,
"aria-controls": "app-menu-nav-container app-menu-profile-button",
children: y.formatMessage({
id: _ ? "unity:component:app-menu:header:menu-close" : "unity:component:app-menu:header:menu-open",
defaultMessage: _ ? "Close navigation" : "Open navigation"
})
})
})
]
})]
}), /* @__PURE__ */ s("div", {
className: "uy:hidden uy:md:flex",
children: h
})]
});
};
//#endregion
export { d as AppMenuHeader };