|
| 1 | +import React from 'react'; |
| 2 | +import { InlineShareButtons } from 'sharethis-reactjs'; |
| 3 | +import { useTranslation } from './app-state'; |
| 4 | + |
| 5 | +import './SocialShare.scss'; |
| 6 | + |
| 7 | +interface SocialShareProps { |
| 8 | + name: string; |
| 9 | + description: string; |
| 10 | + imageHref: string; |
| 11 | +} |
| 12 | + |
| 13 | +export const SocialShare: React.FC<SocialShareProps> = (props) => { |
| 14 | + const { t } = useTranslation(); |
| 15 | + |
| 16 | + return ( |
| 17 | + <div className="socialshare"> |
| 18 | + <InlineShareButtons |
| 19 | + config={{ |
| 20 | + alignment: 'left', // alignment of buttons (left, center, right) |
| 21 | + color: 'social', // set the color of buttons (social, white) |
| 22 | + enabled: true, // show/hide buttons (true, false) |
| 23 | + font_size: 16, // font size for the buttons |
| 24 | + labels: 'cta', // button labels (cta, counts, null) |
| 25 | + networks: [ // which networks to include (see SHARING NETWORKS) |
| 26 | + 'facebook', |
| 27 | + 'twitter', |
| 28 | + 'pinterest', |
| 29 | + 'email', |
| 30 | + ], |
| 31 | + padding: 12, // padding within buttons (INTEGER) |
| 32 | + radius: 4, // the corner radius on each button (INTEGER) |
| 33 | + size: 40, // the size of each button (INTEGER) |
| 34 | + show_total: false, |
| 35 | + image: props.imageHref, // (defaults to og:image or twitter:image) |
| 36 | + description: props.description, // (defaults to og:description or twitter:description) |
| 37 | + title: t('social-share-title', { productName: props.name }), // (defaults to og:title or twitter:title) |
| 38 | + subject: t('social-share-subject', { productName: props.name }), // (defaults to og:title or twitter:title) |
| 39 | + message: t('social-share-message', { productName: props.name, description: props.description, link: window.location.href }), // (defaults to og:title or twitter:title) |
| 40 | + }} |
| 41 | + /> |
| 42 | + </div> |
| 43 | + ); |
| 44 | +}; |
0 commit comments