Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Social Links: add X #54092

Merged
merged 10 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
8 changes: 8 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,13 @@ const variations = [
title: 'WhatsApp',
icon: WhatsAppIcon,
},
{
name: 'x',
attributes: { service: 'x' },
keywords: [ 'Twitter' ],
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"} /-->