-
Notifications
You must be signed in to change notification settings - Fork 875
/
PostPublish.js
50 lines (47 loc) · 1.46 KB
/
PostPublish.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import PropTypes from "prop-types";
import { __ } from "@wordpress/i18n";
import { Fragment } from "@wordpress/element";
import { ReactComponent as FacebookIcon } from "../../images/icon-facebook.svg";
import { ReactComponent as TwitterIcon } from "../../images/x-logo.svg";
/**
* Renders the PostPublish Yoast integration.
*
* @returns {wp.Element} The PostPublish panel.
*/
export default function PostPublish( { permalink } ) {
const encodedUrl = encodeURI( permalink );
return <Fragment>
<div>
{ __( "Share your post!", "wordpress-seo" ) }
</div>
<ul className="yoast-seo-social-share-buttons">
<li>
<a href={ "https://www.facebook.com/sharer/sharer.php?u=" + encodedUrl } target="_blank" rel="noopener noreferrer">
<FacebookIcon />
{ __( "Facebook", "wordpress-seo" ) }
<span className="screen-reader-text">
{
/* translators: Hidden accessibility text. */
__( "(Opens in a new browser tab)", "wordpress-seo" )
}
</span>
</a>
</li>
<li>
<a href={ "https://twitter.com/share?url=" + encodedUrl } target="_blank" rel="noopener noreferrer" class="x-share">
<TwitterIcon />
{ __( "X", "wordpress-seo" ) }
<span className="screen-reader-text">
{
/* translators: Hidden accessibility text. */
__( "(Opens in a new browser tab)", "wordpress-seo" )
}
</span>
</a>
</li>
</ul>
</Fragment>;
}
PostPublish.propTypes = {
permalink: PropTypes.string.isRequired,
};