From 985f76375acabdd6e87ea3dca5dcb6ecdf3f3493 Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Thu, 31 Aug 2023 14:22:36 +0200 Subject: [PATCH 1/7] Social Links: add X Fixes #53223 --- packages/block-library/src/social-link/icons/index.js | 1 + packages/block-library/src/social-link/icons/x.js | 10 ++++++++++ packages/block-library/src/social-link/index.php | 4 ++++ .../src/social-link/socials-with-bg.scss | 5 +++++ .../src/social-link/socials-without-bg.scss | 4 ++++ packages/block-library/src/social-link/variations.js | 7 +++++++ .../fixtures/blocks/core__social-link-x.html | 1 + .../fixtures/blocks/core__social-link-x.json | 11 +++++++++++ .../fixtures/blocks/core__social-link-x.parsed.json | 11 +++++++++++ .../blocks/core__social-link-x.serialized.html | 1 + 10 files changed, 55 insertions(+) create mode 100644 packages/block-library/src/social-link/icons/x.js create mode 100644 test/integration/fixtures/blocks/core__social-link-x.html create mode 100644 test/integration/fixtures/blocks/core__social-link-x.json create mode 100644 test/integration/fixtures/blocks/core__social-link-x.parsed.json create mode 100644 test/integration/fixtures/blocks/core__social-link-x.serialized.html diff --git a/packages/block-library/src/social-link/icons/index.js b/packages/block-library/src/social-link/icons/index.js index 62c32d2d5f35c..85de13090ad5d 100644 --- a/packages/block-library/src/social-link/icons/index.js +++ b/packages/block-library/src/social-link/icons/index.js @@ -40,5 +40,6 @@ export * from './vimeo'; export * from './vk'; export * from './whatsapp'; export * from './wordpress'; +export * from './x'; export * from './yelp'; export * from './youtube'; diff --git a/packages/block-library/src/social-link/icons/x.js b/packages/block-library/src/social-link/icons/x.js new file mode 100644 index 0000000000000..86aeab4d9cc02 --- /dev/null +++ b/packages/block-library/src/social-link/icons/x.js @@ -0,0 +1,10 @@ +/** + * WordPress dependencies + */ +import { Path, SVG } from '@wordpress/primitives'; + +export const XIcon = () => ( + + + +); diff --git a/packages/block-library/src/social-link/index.php b/packages/block-library/src/social-link/index.php index 1ce60ff49fb41..bfcc11e485e1d 100644 --- a/packages/block-library/src/social-link/index.php +++ b/packages/block-library/src/social-link/index.php @@ -306,6 +306,10 @@ function block_core_social_link_services( $service = '', $field = '' ) { 'name' => 'Share Icon', 'icon' => '', ), + 'x' => array( + 'name' => 'X Icon', + 'icon' => '', + ), ); if ( ! empty( $service ) diff --git a/packages/block-library/src/social-link/socials-with-bg.scss b/packages/block-library/src/social-link/socials-with-bg.scss index 042db464f6ee2..3ee9b4b5148a8 100644 --- a/packages/block-library/src/social-link/socials-with-bg.scss +++ b/packages/block-library/src/social-link/socials-with-bg.scss @@ -199,6 +199,11 @@ color: #fff; } +.wp-social-link-x { + background-color: #000; + color: #fff; +} + .wp-social-link-yelp { background-color: #d32422; color: #fff; diff --git a/packages/block-library/src/social-link/socials-without-bg.scss b/packages/block-library/src/social-link/socials-without-bg.scss index ea8fca5d7ab83..aa84b5ab1433c 100644 --- a/packages/block-library/src/social-link/socials-without-bg.scss +++ b/packages/block-library/src/social-link/socials-without-bg.scss @@ -155,6 +155,10 @@ color: #3499cd; } +.wp-social-link-x { + color: #000; +} + .wp-social-link-yelp { color: #d32422; } diff --git a/packages/block-library/src/social-link/variations.js b/packages/block-library/src/social-link/variations.js index 47307ca65c088..7a9410c8ba9a1 100644 --- a/packages/block-library/src/social-link/variations.js +++ b/packages/block-library/src/social-link/variations.js @@ -44,6 +44,7 @@ import { VkIcon, WhatsAppIcon, WordPressIcon, + XIcon, YelpIcon, YouTubeIcon, } from './icons'; @@ -304,6 +305,12 @@ const variations = [ title: 'WhatsApp', icon: WhatsAppIcon, }, + { + name: 'x', + attributes: { service: 'x' }, + title: 'X', + icon: XIcon, + }, { name: 'yelp', attributes: { service: 'yelp' }, diff --git a/test/integration/fixtures/blocks/core__social-link-x.html b/test/integration/fixtures/blocks/core__social-link-x.html new file mode 100644 index 0000000000000..a587f2d0962f6 --- /dev/null +++ b/test/integration/fixtures/blocks/core__social-link-x.html @@ -0,0 +1 @@ + diff --git a/test/integration/fixtures/blocks/core__social-link-x.json b/test/integration/fixtures/blocks/core__social-link-x.json new file mode 100644 index 0000000000000..d0cf492d2aa03 --- /dev/null +++ b/test/integration/fixtures/blocks/core__social-link-x.json @@ -0,0 +1,11 @@ +[ + { + "name": "core/social-link", + "isValid": true, + "attributes": { + "url": "https://example.com/", + "service": "x" + }, + "innerBlocks": [] + } +] diff --git a/test/integration/fixtures/blocks/core__social-link-x.parsed.json b/test/integration/fixtures/blocks/core__social-link-x.parsed.json new file mode 100644 index 0000000000000..2119720f5db0f --- /dev/null +++ b/test/integration/fixtures/blocks/core__social-link-x.parsed.json @@ -0,0 +1,11 @@ +[ + { + "blockName": "core/social-link-x", + "attrs": { + "url": "https://example.com/" + }, + "innerBlocks": [], + "innerHTML": "", + "innerContent": [] + } +] diff --git a/test/integration/fixtures/blocks/core__social-link-x.serialized.html b/test/integration/fixtures/blocks/core__social-link-x.serialized.html new file mode 100644 index 0000000000000..be00807af4c9e --- /dev/null +++ b/test/integration/fixtures/blocks/core__social-link-x.serialized.html @@ -0,0 +1 @@ + From bbaede9070bed709bbc13cd4766d7105061d2f11 Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Thu, 31 Aug 2023 14:32:38 +0200 Subject: [PATCH 2/7] Add Twitter keyword to variation This will allow people to find the new icon when searching for Twitter. See https://github.com/WordPress/gutenberg/issues/53223#issuecomment-1692334880 --- packages/block-library/src/social-link/variations.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/block-library/src/social-link/variations.js b/packages/block-library/src/social-link/variations.js index 7a9410c8ba9a1..4fd4c0bd7e414 100644 --- a/packages/block-library/src/social-link/variations.js +++ b/packages/block-library/src/social-link/variations.js @@ -308,6 +308,7 @@ const variations = [ { name: 'x', attributes: { service: 'x' }, + keywords: [ 'Twitter' ], title: 'X', icon: XIcon, }, From fd299b471c387dedc19f9868377b560a3e006d7c Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Mon, 4 Sep 2023 13:30:37 +0200 Subject: [PATCH 3/7] Reorder links alphabetically Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com> --- packages/block-library/src/social-link/index.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/block-library/src/social-link/index.php b/packages/block-library/src/social-link/index.php index bfcc11e485e1d..de5a04d6adf16 100644 --- a/packages/block-library/src/social-link/index.php +++ b/packages/block-library/src/social-link/index.php @@ -238,6 +238,10 @@ function block_core_social_link_services( $service = '', $field = '' ) { 'name' => 'Reddit', 'icon' => '', ), + 'share' => array( + 'name' => 'Share Icon', + 'icon' => '', + ), 'skype' => array( 'name' => 'Skype', 'icon' => '', @@ -294,6 +298,10 @@ function block_core_social_link_services( $service = '', $field = '' ) { 'name' => 'WhatsApp', 'icon' => '', ), + 'x' => array( + 'name' => 'X Icon', + 'icon' => '', + ), 'yelp' => array( 'name' => 'Yelp', 'icon' => '', @@ -302,14 +310,6 @@ function block_core_social_link_services( $service = '', $field = '' ) { 'name' => 'YouTube', 'icon' => '', ), - 'share' => array( - 'name' => 'Share Icon', - 'icon' => '', - ), - 'x' => array( - 'name' => 'X Icon', - 'icon' => '', - ), ); if ( ! empty( $service ) From a0a1b8695cf2ecb1275aabfbb7fb128522d2956d Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Mon, 4 Sep 2023 13:31:26 +0200 Subject: [PATCH 4/7] No need for a capital letter Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com> --- packages/block-library/src/social-link/variations.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/social-link/variations.js b/packages/block-library/src/social-link/variations.js index 4fd4c0bd7e414..5b03b85ae4e60 100644 --- a/packages/block-library/src/social-link/variations.js +++ b/packages/block-library/src/social-link/variations.js @@ -308,7 +308,7 @@ const variations = [ { name: 'x', attributes: { service: 'x' }, - keywords: [ 'Twitter' ], + keywords: [ 'twitter' ], title: 'X', icon: XIcon, }, From 294f2f703a073cc7ebcd60177c2d7f98f0bc4fcc Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Wed, 13 Sep 2023 10:40:54 +0200 Subject: [PATCH 5/7] Fix svg attributes See https://github.com/WordPress/gutenberg/pull/54092#discussion_r1322030940 Co-authored-by: Rich Tabor --- packages/block-library/src/social-link/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/social-link/index.php b/packages/block-library/src/social-link/index.php index de5a04d6adf16..525fd4d6cafcc 100644 --- a/packages/block-library/src/social-link/index.php +++ b/packages/block-library/src/social-link/index.php @@ -300,7 +300,7 @@ function block_core_social_link_services( $service = '', $field = '' ) { ), 'x' => array( 'name' => 'X Icon', - 'icon' => '', + 'icon' => '', ), 'yelp' => array( 'name' => 'Yelp', From 3b83502e6dc14a715789dac83f7a67d85884b900 Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Mon, 25 Sep 2023 09:57:51 +0200 Subject: [PATCH 6/7] Remove "icon" Co-authored-by: Nick Diego --- packages/block-library/src/social-link/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/social-link/index.php b/packages/block-library/src/social-link/index.php index 525fd4d6cafcc..622030043c70f 100644 --- a/packages/block-library/src/social-link/index.php +++ b/packages/block-library/src/social-link/index.php @@ -299,7 +299,7 @@ function block_core_social_link_services( $service = '', $field = '' ) { 'icon' => '', ), 'x' => array( - 'name' => 'X Icon', + 'name' => 'X', 'icon' => '', ), 'yelp' => array( From f4154f040afe50e6b7e3296de49524c188ae59a2 Mon Sep 17 00:00:00 2001 From: Nick Diego Date: Mon, 25 Sep 2023 10:05:09 +0200 Subject: [PATCH 7/7] Update X icon path See https://github.com/WordPress/gutenberg/pull/54092#discussion_r1334659450 See https://github.com/WordPress/gutenberg/pull/54092#discussion_r1334660867 --- packages/block-library/src/social-link/icons/x.js | 2 +- packages/block-library/src/social-link/index.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/social-link/icons/x.js b/packages/block-library/src/social-link/icons/x.js index 86aeab4d9cc02..cd70775ad7cb8 100644 --- a/packages/block-library/src/social-link/icons/x.js +++ b/packages/block-library/src/social-link/icons/x.js @@ -5,6 +5,6 @@ import { Path, SVG } from '@wordpress/primitives'; export const XIcon = () => ( - + ); diff --git a/packages/block-library/src/social-link/index.php b/packages/block-library/src/social-link/index.php index 622030043c70f..cda8e125097a5 100644 --- a/packages/block-library/src/social-link/index.php +++ b/packages/block-library/src/social-link/index.php @@ -300,7 +300,7 @@ function block_core_social_link_services( $service = '', $field = '' ) { ), 'x' => array( 'name' => 'X', - 'icon' => '', + 'icon' => '', ), 'yelp' => array( 'name' => 'Yelp',