UNPKG

@wordpress/block-editor

Version:
42 lines (41 loc) 1.62 kB
// packages/block-editor/src/components/block-draggable/draggable-chip.js import { __, _n, sprintf } from "@wordpress/i18n"; import { Flex, FlexItem } from "@wordpress/components"; import { dragHandle } from "@wordpress/icons"; import BlockIcon from "../block-icon"; import { jsx, jsxs } from "react/jsx-runtime"; function BlockDraggableChip({ count, icon, isPattern, fadeWhenDisabled }) { const patternLabel = isPattern && __("Pattern"); return /* @__PURE__ */ jsx("div", { className: "block-editor-block-draggable-chip-wrapper", children: /* @__PURE__ */ jsx( "div", { className: "block-editor-block-draggable-chip", "data-testid": "block-draggable-chip", children: /* @__PURE__ */ jsxs( Flex, { justify: "center", className: "block-editor-block-draggable-chip__content", children: [ /* @__PURE__ */ jsx(FlexItem, { children: icon ? /* @__PURE__ */ jsx(BlockIcon, { icon }) : patternLabel || sprintf( /* translators: %d: Number of blocks. */ _n("%d block", "%d blocks", count), count ) }), /* @__PURE__ */ jsx(FlexItem, { children: /* @__PURE__ */ jsx(BlockIcon, { icon: dragHandle }) }), fadeWhenDisabled && /* @__PURE__ */ jsx(FlexItem, { className: "block-editor-block-draggable-chip__disabled", children: /* @__PURE__ */ jsx("span", { className: "block-editor-block-draggable-chip__disabled-icon" }) }) ] } ) } ) }); } export { BlockDraggableChip as default }; //# sourceMappingURL=draggable-chip.js.map