/** * WordPress dependencies */ import { ToggleControl } from '@safe-wordpress/components'; import { _x } from '@safe-wordpress/i18n'; /** * External dependencies */ import { css } from '@nelio/popups/css'; import { ColorControl, CSSUnitControl } from '@nelio/popups/components'; import { useWrapperSetting } from '@nelio/popups/hooks'; import type { BorderSettings } from '@nelio/popups/types'; const DEFAULT_BORDER: BorderSettings = { isEnabled: true, radius: { value: 0, unit: 'px', }, color: '#FFFFFF', width: { value: 0, unit: 'px', }, }; export const BorderControl = (): JSX.Element => { const [ border, setBorder ] = useWrapperSetting( 'border' ); const { isEnabled } = border; const onChange = ( isActive: boolean ) => setBorder( { ...DEFAULT_BORDER, isEnabled: isActive } ); return ( <> { isEnabled && ( <> setBorder( { ...border, color } ) } />
setBorder( { ...border, radius } ) } /> setBorder( { ...border, width } ) } />
) } ); }; // ====== // STYLES // ====== const SIZE_STYLE = css( { display: 'flex', flexDirection: 'row', gap: '0.5em', marginTop: '1em', '> *': { width: 'calc(50% - 0.25em)', }, } );