Properly set block opt-in checkbox label to render with correct classes

This fixes verical misalignment between the checkbox and the label

[MAILPOET-6436]
This commit is contained in:
 Ján Mikláš
2025-01-16 11:18:33 +01:00
committed by Aschepikov
parent 1372de1bba
commit a4d67a319a
2 changed files with 10 additions and 4 deletions

View File

@@ -30,8 +30,10 @@ export function FrontendBlock({
}
return (
<CheckboxControl checked={checked} onChange={setChecked}>
<RawHTML>{text || defaultText}</RawHTML>
</CheckboxControl>
<CheckboxControl
checked={checked}
onChange={setChecked}
label={<RawHTML>{text || defaultText}</RawHTML>}
/>
);
}

View File

@@ -56,7 +56,11 @@ export function Edit({
<div {...blockProps}>
{optinEnabled ? (
<div className="wc-block-checkout__marketing">
<CheckboxControl id="mailpoet-marketing-optin" checked={false} />
<CheckboxControl
id="mailpoet-marketing-optin"
checked={false}
onChange={() => {}}
/>
<RichText
value={currentText}
onChange={(value) => setAttributes({ text: value })}