Skip to content

Commit

Permalink
Social Links: add X
Browse files Browse the repository at this point in the history
  • Loading branch information
jeherve committed Aug 31, 2023
1 parent 0d7548f commit 985f763
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/block-library/src/social-link/icons/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
10 changes: 10 additions & 0 deletions packages/block-library/src/social-link/icons/x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* WordPress dependencies
*/
import { Path, SVG } from '@wordpress/primitives';

export const XIcon = () => (
<SVG width="24" height="24" viewBox="0 0 24 24" version="1.1">
<Path d="M14.1173 9.62177L20.4459 2H18.9463L13.4511 8.61788L9.06215 2H4L10.637 12.0074L4 20H5.49977L11.3028 13.0113L15.9379 20H21L14.1169 9.62177H14.1173ZM12.0632 12.0956L11.3907 11.0991L6.04016 3.16971H8.34371L12.6617 9.56895L13.3341 10.5655L18.947 18.8835H16.6434L12.0632 12.096V12.0956Z" />
</SVG>
);
4 changes: 4 additions & 0 deletions packages/block-library/src/social-link/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ function block_core_social_link_services( $service = '', $field = '' ) {
'name' => 'Share Icon',
'icon' => '<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9 11.8l6.1-4.5c.1.4.4.7.9.7h2c.6 0 1-.4 1-1V5c0-.6-.4-1-1-1h-2c-.6 0-1 .4-1 1v.4l-6.4 4.8c-.2-.1-.4-.2-.6-.2H6c-.6 0-1 .4-1 1v2c0 .6.4 1 1 1h2c.2 0 .4-.1.6-.2l6.4 4.8v.4c0 .6.4 1 1 1h2c.6 0 1-.4 1-1v-2c0-.6-.4-1-1-1h-2c-.5 0-.8.3-.9.7L9 12.2v-.4z"/></svg>',
),
'x' => array(
'name' => 'X Icon',
'icon' => '<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14.1173 9.62177L20.4459 2H18.9463L13.4511 8.61788L9.06215 2H4L10.637 12.0074L4 20H5.49977L11.3028 13.0113L15.9379 20H21L14.1169 9.62177H14.1173ZM12.0632 12.0956L11.3907 11.0991L6.04016 3.16971H8.34371L12.6617 9.56895L13.3341 10.5655L18.947 18.8835H16.6434L12.0632 12.096V12.0956Z" /></svg>',
),
);

if ( ! empty( $service )
Expand Down
5 changes: 5 additions & 0 deletions packages/block-library/src/social-link/socials-with-bg.scss
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@
color: #fff;
}

.wp-social-link-x {
background-color: #000;
color: #fff;
}

.wp-social-link-yelp {
background-color: #d32422;
color: #fff;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@
color: #3499cd;
}

.wp-social-link-x {
color: #000;
}

.wp-social-link-yelp {
color: #d32422;
}
Expand Down
7 changes: 7 additions & 0 deletions packages/block-library/src/social-link/variations.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
VkIcon,
WhatsAppIcon,
WordPressIcon,
XIcon,
YelpIcon,
YouTubeIcon,
} from './icons';
Expand Down Expand Up @@ -304,6 +305,12 @@ const variations = [
title: 'WhatsApp',
icon: WhatsAppIcon,
},
{
name: 'x',
attributes: { service: 'x' },
title: 'X',
icon: XIcon,
},
{
name: 'yelp',
attributes: { service: 'yelp' },
Expand Down
1 change: 1 addition & 0 deletions test/integration/fixtures/blocks/core__social-link-x.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- wp:social-link-x {"url":"https://example.com/"} /-->
11 changes: 11 additions & 0 deletions test/integration/fixtures/blocks/core__social-link-x.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"name": "core/social-link",
"isValid": true,
"attributes": {
"url": "https://example.com/",
"service": "x"
},
"innerBlocks": []
}
]
11 changes: 11 additions & 0 deletions test/integration/fixtures/blocks/core__social-link-x.parsed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"blockName": "core/social-link-x",
"attrs": {
"url": "https://example.com/"
},
"innerBlocks": [],
"innerHTML": "",
"innerContent": []
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- wp:social-link {"url":"https://example.com/","service":"x"} /-->

0 comments on commit 985f763

Please sign in to comment.