@wordpress/block-library
Version:
Block library for the WordPress editor.
40 lines (39 loc) • 1.24 kB
JavaScript
// packages/block-library/src/tab-list/save.js
import clsx from "clsx";
import {
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(
"button",
{
className: buttonClassName || void 0,
style: buttonStyle,
type: "button",
role: "tab",
children: tab.label
},
index
)) });
}
export {
save as default
};
//# sourceMappingURL=save.mjs.map