blob: ca53ef91f89e3c21cc0d70e95d959decbd9e577e (
plain)
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
|
import { FC } from 'react';
import { useIntl } from 'react-intl';
import styles from './sharing-link.module.scss';
export type SharingMedium =
| 'diaspora'
| 'email'
| 'facebook'
| 'journal-du-hacker'
| 'linkedin'
| 'twitter';
export type SharingLinkProps = {
/**
* The sharing medium id.
*/
medium: SharingMedium;
/**
* The sharing url.
*/
url: string;
};
/**
* SharingLink component
*
* Render a sharing link.
*/
const SharingLink: FC<SharingLinkProps> = ({ medium, url }) => {
const intl = useIntl();
const text = intl.formatMessage(
{
defaultMessage: 'Share on {name}',
description: 'Sharing: share on social network text',
id: 'ureXFw',
},
{ name: medium }
);
const mediumClass = `link--${medium}`;
return (
<a href={url} className={`${styles.link} ${styles[mediumClass]}`}>
<span className="screen-reader-text">{text}</span>
</a>
);
};
export default SharingLink;
|