-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore: Fix: Do not show Gradient panel if gradients are not av… (#18091)
- Loading branch information
1 parent
0b76cc9
commit f2b9682
Showing
3 changed files
with
48 additions
and
17 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
packages/block-editor/src/components/gradient-picker/panel.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { isEmpty } from 'lodash'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useSelect } from '@wordpress/data'; | ||
import { PanelBody } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import GradientPicker from './control'; | ||
|
||
export default function GradientPanel( props ) { | ||
const gradients = useSelect( ( select ) => ( | ||
select( 'core/block-editor' ).getSettings().gradients | ||
) ); | ||
if ( isEmpty( gradients ) ) { | ||
return null; | ||
} | ||
return ( | ||
<PanelBody title={ __( 'Gradient' ) }> | ||
<GradientPicker | ||
{ ...props } | ||
/> | ||
</PanelBody> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters