Merge de1e6c6cd7d0271039b634326d2178d95e807282 into 4de580b7dfb4c2785828d5d910b558a007e94547

This commit is contained in:
Ján Mikláš 2025-02-14 10:31:26 +01:00 committed by GitHub
commit daad7d666b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 8 deletions

View File

@ -39,13 +39,13 @@ interface JQuery {
declare module '@woocommerce/blocks-checkout' {
type CheckboxControlProps = {
className?: string;
label?: string;
label?: string | React.ReactNode;
id?: string;
instanceId?: string;
onChange?: (value: boolean) => void;
children?: React.ReactChildren | React.ReactElement;
onChange: (value: boolean) => void;
children?: React.ReactChildren;
hasError?: boolean;
checked?: boolean;
disabled?: string | boolean | undefined;
};
export const CheckboxControl: (props: CheckboxControlProps) => JSX.Element;
}

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 })}