carhop__plugins__PROD-DEV/plugins/carhop-blocks/blocks/content-box/src/save.js
Antoine M d72159c9e4
All checks were successful
continuous-integration/drone/push Build is passing
FEATURE Adapting content box to be handle by dynamic articles
2025-08-27 11:01:43 +02:00

31 lines
798 B
JavaScript

import { useBlockProps, InnerBlocks } from "@wordpress/block-editor";
import { isColorLight } from "../../_utilities/utilities";
export default function save({ attributes }) {
const {
backgroundColor,
textColor,
hasLightBackground,
hasBackgroundColor,
blockVariant,
} = attributes;
return (
<section
{...useBlockProps.save({
className: `content-box content-box--variant-${blockVariant} ${
hasLightBackground ? "content-box--bg-light" : "content-box--bg-dark"
}`,
style: {
"--content-box-text-color": textColor ?? "inherit",
"--content-box-background-color":
blockVariant === "backgrounded" ? backgroundColor : "transparent",
},
})}
>
<div className="content-box__innerblocks">
<InnerBlocks.Content />
</div>
</section>
);
}