2024-10-23 08:56:47 +02:00
|
|
|
import { ToggleControl } from '@wordpress/components';
|
|
|
|
|
2024-11-11 14:02:49 +01:00
|
|
|
const OnboardingSettingsToggleBlock = ( {
|
|
|
|
isToggled,
|
|
|
|
setToggled,
|
|
|
|
...props
|
|
|
|
} ) => {
|
2024-10-23 08:56:47 +02:00
|
|
|
return (
|
|
|
|
<div className="ppcp-r-toggle-block">
|
|
|
|
<div className="ppcp-r-toggle-block__wrapper">
|
|
|
|
<div className="ppcp-r-toggle-block__content">
|
|
|
|
{ props?.label && (
|
|
|
|
<span className="ppcp-r-toggle-block__content-label">
|
|
|
|
{ props.label }
|
|
|
|
</span>
|
|
|
|
) }
|
|
|
|
{ props?.description && (
|
|
|
|
<p
|
|
|
|
className="ppcp-r-toggle-block__content-description"
|
|
|
|
dangerouslySetInnerHTML={ {
|
|
|
|
__html: props.description,
|
|
|
|
} }
|
|
|
|
></p>
|
|
|
|
) }
|
|
|
|
</div>
|
|
|
|
<div className="ppcp-r-toggle-block__switch">
|
|
|
|
<ToggleControl
|
|
|
|
checked={ isToggled }
|
|
|
|
onChange={ ( newValue ) => {
|
|
|
|
setToggled( newValue );
|
|
|
|
} }
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{ props.children && isToggled && (
|
|
|
|
<div className="ppcp-r-toggle-block__toggled-content">
|
|
|
|
{ props.children }
|
|
|
|
</div>
|
|
|
|
) }
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2024-11-11 14:02:49 +01:00
|
|
|
export default OnboardingSettingsToggleBlock;
|