Skip to content

Commit

Permalink
Hide presets when there are less or exactly one presets available (#6…
Browse files Browse the repository at this point in the history
…2074)

* hide the presets panel for when there are less or exactly one presets available

* tweak logic to return null if there is only one variation (the default).

---------

Co-authored-by: draganescu <andraganescu@git.wordpress.org>
Co-authored-by: richtabor <richtabor@git.wordpress.org>
Co-authored-by: MaggieCabrera <onemaggie@git.wordpress.org>
Co-authored-by: bgardner <bgardner@git.wordpress.org>
Co-authored-by: hbhalodia <hbhalodia@git.wordpress.org>
  • Loading branch information
6 people authored May 30, 2024
1 parent ee3d1ea commit d35a1f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import Variation from './variation';
export default function ColorVariations( { title, gap = 2 } ) {
const colorVariations = useColorVariations();

if ( ! colorVariations?.length ) {
// Return null if there is only one variation (the default).
if ( colorVariations?.length <= 1 ) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import Subtitle from '../subtitle';
export default function TypographyVariations( { title, gap = 2 } ) {
const typographyVariations = useTypographyVariations();

if ( ! typographyVariations?.length ) {
// Return null if there is only one variation (the default).
if ( typographyVariations?.length <= 1 ) {
return null;
}

Expand Down

0 comments on commit d35a1f0

Please sign in to comment.