@wordpress/block-library
Version:
Block library for the WordPress editor.
42 lines (41 loc) • 1.28 kB
JavaScript
// packages/block-library/src/tab-list/save.js
import clsx from "clsx";
import {
RichText,
useBlockProps,
__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,
__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,
__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles
} from "@wordpress/block-editor";
import { jsx } from "react/jsx-runtime";
function save({ attributes }) {
const { tabs } = attributes;
const blockProps = useBlockProps.save({
role: "tablist"
});
const colorProps = getColorClassesAndStyles(attributes);
const borderProps = getBorderClassesAndStyles(attributes);
const spacingProps = getSpacingClassesAndStyles(attributes);
const buttonClassName = clsx(colorProps.className, borderProps.className);
const buttonStyle = {
...colorProps.style,
...borderProps.style,
...spacingProps.style
};
return /* @__PURE__ */ jsx("div", { ...blockProps, children: tabs.map((tab, index) => /* @__PURE__ */ jsx(
RichText.Content,
{
className: buttonClassName || void 0,
style: buttonStyle,
tagName: "button",
value: tab.label,
type: "button",
role: "tab"
},
index
)) });
}
export {
save as default
};
//# sourceMappingURL=save.mjs.map