From 54318c68743edbc2216cf1e10b4c32ef9c20b011 Mon Sep 17 00:00:00 2001 From: Sarah Norris Date: Sat, 1 Apr 2023 21:39:22 +0100 Subject: [PATCH 1/2] Add checkbox labels to font family variants --- src/google-fonts/font-variant.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/google-fonts/font-variant.js b/src/google-fonts/font-variant.js index 54fd1509..46efbc0b 100644 --- a/src/google-fonts/font-variant.js +++ b/src/google-fonts/font-variant.js @@ -32,21 +32,31 @@ function FontVariant( { font, variant, isSelected, handleToggle } ) { } ); }, [ font, variant ] ); + const formattedFontFamily = font.family.toLowerCase().replace( ' ', '-' ); + const fontId = `${ formattedFontFamily }-${ variant }`; + return ( - { weight } - { style } + + + + + + - + ); From 072da09df4ffebebb53c5cd817908545b6e097b2 Mon Sep 17 00:00:00 2001 From: Sarah Norris Date: Sat, 1 Apr 2023 21:39:54 +0100 Subject: [PATCH 2/2] Add checkbox labels to font family table header --- src/google-fonts/index.js | 44 ++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/src/google-fonts/index.js b/src/google-fonts/index.js index f7571260..0cc07b69 100644 --- a/src/google-fonts/index.js +++ b/src/google-fonts/index.js @@ -156,6 +156,13 @@ function GoogleFonts() { setSelectedFont( googleFontsData.items[ value ] ); }; + let selectedFontFamilyId = ''; + if ( selectedFont ) { + selectedFontFamilyId = selectedFont.family + .toLowerCase() + .replace( ' ', '-' ); + } + return (
@@ -235,6 +242,7 @@ function GoogleFonts() { handleToggleAllVariants( selectedFont.family @@ -250,22 +258,34 @@ function GoogleFonts() { /> - { __( - 'Weight', - 'create-block-theme' - ) } + - { __( - 'Style', - 'create-block-theme' - ) } + - { __( - 'Preview', - 'create-block-theme' - ) } +