@wordpress/global-styles-ui
Version:
Global Styles UI components for WordPress.
32 lines (31 loc) • 1.31 kB
JavaScript
import { Button, FlexItem, __experimentalSpacer } from "@wordpress/components";
import { moreVertical } from "@wordpress/icons";
import { Menu, Stack } from "@wordpress/ui";
import { ScreenHeader } from "../screen-header.mjs";
import { jsx, jsxs } from "react/jsx-runtime";
// packages/global-styles-ui/src/presets/preset-edit-header.tsx
function PresetEditHeader({ title, description, menuLabel, menuItems }) {
return /* @__PURE__ */ jsxs(Stack, {
justify: "space-between",
align: "flex-start",
children: [/* @__PURE__ */ jsx(ScreenHeader, {
title,
description
}), menuItems.length > 0 && /* @__PURE__ */ jsx(FlexItem, { children: /* @__PURE__ */ jsx(__experimentalSpacer, {
marginTop: 2,
marginBottom: 0,
paddingX: 4,
children: /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(Menu.Trigger, { render: /* @__PURE__ */ jsx(Button, {
size: "small",
icon: moreVertical,
label: menuLabel
}) }), /* @__PURE__ */ jsx(Menu.Popup, { children: menuItems.map((item) => /* @__PURE__ */ jsx(Menu.Item, {
disabled: item.disabled,
onClick: item.onClick,
children: /* @__PURE__ */ jsx(Menu.ItemLabel, { children: item.label })
}, item.label)) })] })
}) })]
});
}
export { PresetEditHeader as default };
//# sourceMappingURL=preset-edit-header.mjs.map