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 ( return (
<CheckboxControl checked={checked} onChange={setChecked}> <CheckboxControl
<RawHTML>{text || defaultText}</RawHTML> checked={checked}
</CheckboxControl> onChange={setChecked}
label={<RawHTML>{text || defaultText}</RawHTML>}
/>
); );
} }

View File

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