UNPKG

@wordpress/global-styles-ui

Version:
46 lines (45 loc) • 2.03 kB
import { Card, CardBody, CardMedia, FlexItem, __experimentalHStack, __experimentalItemGroup, __experimentalVStack } from "@wordpress/components"; import { __, isRTL } from "@wordpress/i18n"; import { chevronLeft, chevronRight } from "@wordpress/icons"; import { useSelect } from "@wordpress/data"; import { store } from "@wordpress/core-data"; import { IconWithCurrentColor } from "./icon-with-current-color.mjs"; import { NavigationButtonAsItem } from "./navigation-button.mjs"; import RootMenu from "./root-menu.mjs"; import PreviewStyles from "./preview-styles.mjs"; import { jsx, jsxs } from "react/jsx-runtime"; // packages/global-styles-ui/src/screen-root.tsx function ScreenRoot() { const hasVariations = useSelect((select) => { const { __experimentalGetCurrentThemeGlobalStylesVariations } = select(store); return !!__experimentalGetCurrentThemeGlobalStylesVariations()?.length; }, []); return /* @__PURE__ */ jsx(Card, { size: "small", isBorderless: true, className: "global-styles-ui-screen-root", isRounded: false, children: /* @__PURE__ */ jsx(CardBody, { children: /* @__PURE__ */ jsxs(__experimentalVStack, { spacing: 4, children: [ /* @__PURE__ */ jsx(Card, { className: "global-styles-ui-screen-root__active-style-tile", children: /* @__PURE__ */ jsx(CardMedia, { className: "global-styles-ui-screen-root__active-style-tile-preview", children: /* @__PURE__ */ jsx(PreviewStyles, {}) }) }), hasVariations && /* @__PURE__ */ jsx(__experimentalItemGroup, { children: /* @__PURE__ */ jsx(NavigationButtonAsItem, { path: "/variations", children: /* @__PURE__ */ jsxs(__experimentalHStack, { justify: "space-between", children: [/* @__PURE__ */ jsx(FlexItem, { children: __("Browse styles") }), /* @__PURE__ */ jsx(IconWithCurrentColor, { icon: isRTL() ? chevronLeft : chevronRight })] }) }) }), /* @__PURE__ */ jsx(RootMenu, {}) ] }) }) }); } export { ScreenRoot as default }; //# sourceMappingURL=screen-root.mjs.map