2024-12-08 09:33:49 +01:00
|
|
|
import { ToggleControl } from '@wordpress/components';
|
2025-01-21 18:57:36 +01:00
|
|
|
import SettingsBlock from '../SettingsBlock';
|
|
|
|
import { Header, Title, Action, Description } from '../Elements';
|
2024-12-08 09:33:49 +01:00
|
|
|
|
|
|
|
const ToggleSettingsBlock = ( { title, description, ...props } ) => (
|
2024-12-17 11:50:32 +01:00
|
|
|
<SettingsBlock { ...props } className="ppcp-r-settings-block__toggle">
|
|
|
|
<Action>
|
|
|
|
<ToggleControl
|
|
|
|
className="ppcp-r-settings-block__toggle-control"
|
|
|
|
__nextHasNoMarginBottom={ true }
|
|
|
|
checked={ props.actionProps?.value }
|
|
|
|
onChange={ ( newValue ) =>
|
|
|
|
props.actionProps?.callback(
|
|
|
|
props.actionProps?.key,
|
|
|
|
newValue
|
|
|
|
)
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
</Action>
|
|
|
|
<Header>
|
|
|
|
{ title && <Title>{ title }</Title> }
|
|
|
|
{ description && <Description>{ description }</Description> }
|
|
|
|
</Header>
|
|
|
|
</SettingsBlock>
|
2024-12-08 09:33:49 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
export default ToggleSettingsBlock;
|