Skip to content

Commit

Permalink
Only return to default
Browse files Browse the repository at this point in the history
  • Loading branch information
emeaguiar committed Jul 11, 2022
1 parent 585f1b0 commit 7e6ec7d
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const api = window.wp.customize;

const ColorControl = ( { defaultValue, params, onColorChange, mode } ) => {
const [ color, setColor ] = useState( defaultValue );
const [ previousColor, setPreviousColor ] = useState( defaultValue );
/* @var {Theme} color The current color value. */
const [ displayColorPalette, setDisplayColorPalette ] = useState( false );
const [ materialPickerSelected, setMaterialPickerSelected ] = useState(
Expand All @@ -51,7 +50,6 @@ const ColorControl = ( { defaultValue, params, onColorChange, mode } ) => {
.matches;

const onChange = value => {
setPreviousColor( color );
setColor( value );
};

Expand Down Expand Up @@ -183,7 +181,7 @@ const ColorControl = ( { defaultValue, params, onColorChange, mode } ) => {
<MaterialColorPalette
value={ color }
onChange={ value => {
onChange( value ?? previousColor );
onChange( value ?? defaultValue );
} }
materialColorsOnly={ true }
/>
Expand Down

0 comments on commit 7e6ec7d

Please sign in to comment.