@wordpress/block-library
Version:
Block library for the WordPress editor.
57 lines (56 loc) • 1.77 kB
JavaScript
// packages/block-library/src/accordion-heading/save.js
import {
useBlockProps,
__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,
RichText,
getTypographyClassesAndStyles
} from "@wordpress/block-editor";
import { jsx, jsxs } from "react/jsx-runtime";
function save({ attributes }) {
const { level, title, iconPosition, showIcon } = attributes;
const TagName = "h" + (level || 3);
const typographyProps = getTypographyClassesAndStyles(attributes);
const blockProps = useBlockProps.save();
const spacingProps = getSpacingClassesAndStyles(attributes);
return /* @__PURE__ */ jsx(TagName, { ...blockProps, children: /* @__PURE__ */ jsxs(
"button",
{
className: "wp-block-accordion-heading__toggle",
style: spacingProps.style,
children: [
showIcon && iconPosition === "left" && /* @__PURE__ */ jsx(
"span",
{
className: "wp-block-accordion-heading__toggle-icon",
"aria-hidden": "true",
children: "+"
}
),
/* @__PURE__ */ jsx(
RichText.Content,
{
className: "wp-block-accordion-heading__toggle-title",
tagName: "span",
value: title,
style: {
letterSpacing: typographyProps.style.letterSpacing,
textDecoration: typographyProps.style.textDecoration
}
}
),
showIcon && iconPosition === "right" && /* @__PURE__ */ jsx(
"span",
{
className: "wp-block-accordion-heading__toggle-icon",
"aria-hidden": "true",
children: "+"
}
)
]
}
) });
}
export {
save as default
};
//# sourceMappingURL=save.js.map