From 9217a1c6fd3a94f948699e4a534327de4e587b6d Mon Sep 17 00:00:00 2001 From: Gulamdastgir Date: Thu, 23 Jan 2025 14:40:30 +0530 Subject: [PATCH] Added discord in social links. --- .../block-library/src/social-link/icons/discord.js | 10 ++++++++++ packages/block-library/src/social-link/icons/index.js | 1 + 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__separator-color.json | 4 ++-- .../fixtures/blocks/core__separator-custom-color.json | 4 ++-- .../fixtures/blocks/core__social-link-discord.html | 1 + .../fixtures/blocks/core__social-link-discord.json | 11 +++++++++++ .../blocks/core__social-link-discord.parsed.json | 11 +++++++++++ .../blocks/core__social-link-discord.serialized.html | 1 + 12 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 packages/block-library/src/social-link/icons/discord.js create mode 100644 test/integration/fixtures/blocks/core__social-link-discord.html create mode 100644 test/integration/fixtures/blocks/core__social-link-discord.json create mode 100644 test/integration/fixtures/blocks/core__social-link-discord.parsed.json create mode 100644 test/integration/fixtures/blocks/core__social-link-discord.serialized.html diff --git a/packages/block-library/src/social-link/icons/discord.js b/packages/block-library/src/social-link/icons/discord.js new file mode 100644 index 00000000000000..eee72b5620155b --- /dev/null +++ b/packages/block-library/src/social-link/icons/discord.js @@ -0,0 +1,10 @@ +/** + * WordPress dependencies + */ +import { Path, SVG } from '@wordpress/primitives'; + +export const DiscordIcon = () => ( + + + +); diff --git a/packages/block-library/src/social-link/icons/index.js b/packages/block-library/src/social-link/icons/index.js index 422ff6f02dd20e..bcc1976a7efb03 100644 --- a/packages/block-library/src/social-link/icons/index.js +++ b/packages/block-library/src/social-link/icons/index.js @@ -5,6 +5,7 @@ export * from './bluesky'; export * from './chain'; export * from './codepen'; export * from './deviantart'; +export * from './discord'; export * from './dribbble'; export * from './dropbox'; export * from './etsy'; diff --git a/packages/block-library/src/social-link/index.php b/packages/block-library/src/social-link/index.php index f241daff2a11a8..9775f6dece5d7d 100644 --- a/packages/block-library/src/social-link/index.php +++ b/packages/block-library/src/social-link/index.php @@ -169,6 +169,10 @@ function block_core_social_link_services( $service = '', $field = '' ) { 'name' => 'DeviantArt', 'icon' => '', ), + 'discord' => array( + 'name' => 'Discord', + 'icon' => '', + ), 'dribbble' => array( 'name' => 'Dribbble', 'icon' => '', 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 35420fc624c0e6..b51b718459739d 100644 --- a/packages/block-library/src/social-link/socials-with-bg.scss +++ b/packages/block-library/src/social-link/socials-with-bg.scss @@ -33,6 +33,11 @@ color: #fff; } +.wp-social-link-discord { + background-color: #5865f2; + color: #fff; +} + .wp-social-link-dribbble { background-color: #e94c89; 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 24538b29824b17..12b8620efb9f7f 100644 --- a/packages/block-library/src/social-link/socials-without-bg.scss +++ b/packages/block-library/src/social-link/socials-without-bg.scss @@ -22,6 +22,10 @@ color: #02e49b; } +.wp-social-link-discord { + color: #5865f2; +} + .wp-social-link-dribbble { color: #e94c89; } diff --git a/packages/block-library/src/social-link/variations.js b/packages/block-library/src/social-link/variations.js index a97a396882d761..59fb469181449d 100644 --- a/packages/block-library/src/social-link/variations.js +++ b/packages/block-library/src/social-link/variations.js @@ -9,6 +9,7 @@ import { ChainIcon, CodepenIcon, DeviantArtIcon, + DiscordIcon, DribbbleIcon, DropboxIcon, EtsyIcon, @@ -108,6 +109,12 @@ const variations = [ title: 'DeviantArt', icon: DeviantArtIcon, }, + { + name: 'discord', + attributes: { service: 'discord' }, + title: 'Discord', + icon: DiscordIcon, + }, { name: 'dribbble', attributes: { service: 'dribbble' }, diff --git a/test/integration/fixtures/blocks/core__separator-color.json b/test/integration/fixtures/blocks/core__separator-color.json index d66a8b2e1a242e..d53b7287428038 100644 --- a/test/integration/fixtures/blocks/core__separator-color.json +++ b/test/integration/fixtures/blocks/core__separator-color.json @@ -4,8 +4,8 @@ "isValid": true, "attributes": { "opacity": "alpha-channel", - "backgroundColor": "accent", - "tagName": "hr" + "tagName": "hr", + "backgroundColor": "accent" }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__separator-custom-color.json b/test/integration/fixtures/blocks/core__separator-custom-color.json index 9b126f2b5be6c7..444cf3cf9b19b4 100644 --- a/test/integration/fixtures/blocks/core__separator-custom-color.json +++ b/test/integration/fixtures/blocks/core__separator-custom-color.json @@ -4,12 +4,12 @@ "isValid": true, "attributes": { "opacity": "alpha-channel", + "tagName": "hr", "style": { "color": { "background": "#5da54c" } - }, - "tagName": "hr" + } }, "innerBlocks": [] } diff --git a/test/integration/fixtures/blocks/core__social-link-discord.html b/test/integration/fixtures/blocks/core__social-link-discord.html new file mode 100644 index 00000000000000..e060dec0d1673f --- /dev/null +++ b/test/integration/fixtures/blocks/core__social-link-discord.html @@ -0,0 +1 @@ + diff --git a/test/integration/fixtures/blocks/core__social-link-discord.json b/test/integration/fixtures/blocks/core__social-link-discord.json new file mode 100644 index 00000000000000..fa5ce3ebf051d3 --- /dev/null +++ b/test/integration/fixtures/blocks/core__social-link-discord.json @@ -0,0 +1,11 @@ +[ + { + "name": "core/social-link", + "isValid": true, + "attributes": { + "url": "https://example.com/", + "service": "discord" + }, + "innerBlocks": [] + } +] diff --git a/test/integration/fixtures/blocks/core__social-link-discord.parsed.json b/test/integration/fixtures/blocks/core__social-link-discord.parsed.json new file mode 100644 index 00000000000000..7904c03b69d9d8 --- /dev/null +++ b/test/integration/fixtures/blocks/core__social-link-discord.parsed.json @@ -0,0 +1,11 @@ +[ + { + "blockName": "core/social-link-discord", + "attrs": { + "url": "https://example.com/" + }, + "innerBlocks": [], + "innerHTML": "", + "innerContent": [] + } +] diff --git a/test/integration/fixtures/blocks/core__social-link-discord.serialized.html b/test/integration/fixtures/blocks/core__social-link-discord.serialized.html new file mode 100644 index 00000000000000..c61b5ffcb46a57 --- /dev/null +++ b/test/integration/fixtures/blocks/core__social-link-discord.serialized.html @@ -0,0 +1 @@ +