| 1 |
import styles from './editor.lazy.scss'; |
| 2 |
import { GradientPicker } from '@wordpress/components'; |
| 3 |
import React, { useLayoutEffect } from 'react'; |
| 4 |
|
| 5 |
const GradientSettings = ( props ) => { |
| 6 |
|
| 7 |
// Add and remove the CSS on the drop and remove of the component. |
| 8 |
useLayoutEffect( () => { |
| 9 |
styles.use(); |
| 10 |
return () => { |
| 11 |
styles.unuse(); |
| 12 |
}; |
| 13 |
}, [] ); |
| 14 |
|
| 15 |
const { setAttributes, backgroundGradient } = props; |
| 16 |
|
| 17 |
const onGradientChange = ( value ) => { |
| 18 |
setAttributes( { [ backgroundGradient.label ]: value } ); |
| 19 |
}; |
| 20 |
|
| 21 |
return ( |
| 22 |
<GradientPicker |
| 23 |
value={ backgroundGradient.value } |
| 24 |
onChange={ onGradientChange } |
| 25 |
className="uagb-gradient-picker" |
| 26 |
/> |
| 27 |
); |
| 28 |
} |
| 29 |
|
| 30 |
export default GradientSettings; |
| 31 |
|