blob: 0b9d5fb4fcb30ab27da65ac46d2536365796b8f3 (
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
|
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.
*/
export 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}`;
const linkClass = `${styles.link} ${styles[mediumClass]}`;
return (
<a className={linkClass} href={url}>
<span className="screen-reader-text">{text}</span>
</a>
);
};
|