import { createElement, Component, Fragment } from '@wordpress/element' import classnames from 'classnames' import SinglePicker from './color-picker/single-picker.js' import Slider from './slider.js' import deepEqual from 'deep-equal' const getDefaultsFor = value => ({ // 1 | [1, 2, 3, 4] amount: 0, ...value }) const Border = ({ value, onChange, option }) => { value = getDefaultsFor(value) return (
{[].concat(value.amount).map((singleAmount, i) => ( typeof value.amount !== 'number' && (value.amount || []).length > 1 && ( ) } onChange={amount => onChange({ ...value, amount: typeof value.amount === 'number' ? amount : value.amount.map( (val, index) => index === i ? amount : val ) }) } value={singleAmount} option={{ min: 0, max: 100 }} /> ))}
) } Border.LabelToolbar = ({ value, onChange, option }) => { value = getDefaultsFor(value) return (
) } export default Border