import clsx from 'clsx';
import photon from 'photon';
import PropTypes from 'prop-types';
import { Component } from 'react';
import { connect } from 'react-redux';
import SocialLogo from 'calypso/components/social-logo';
import { gaRecordEvent } from 'calypso/lib/analytics/ga';
import { recordTracksEvent } from 'calypso/lib/analytics/tracks';
import getCurrentRouteParameterized from 'calypso/state/selectors/get-current-route-parameterized';
import { getSelectedSiteId } from 'calypso/state/ui/selectors';
class SharingButtonsPreviewButton extends Component {
static propTypes = {
button: PropTypes.object.isRequired,
style: PropTypes.oneOf( [ 'icon-text', 'icon', 'text', 'official' ] ),
enabled: PropTypes.bool,
onMouseOver: PropTypes.func,
onClick: PropTypes.func,
path: PropTypes.string,
};
static defaultProps = {
style: 'icon',
enabled: true,
onClick: function () {},
};
/* eslint-disable wpcalypso/jsx-classname-namespace */
getIcon() {
const shortnameToSocialLogo = {
email: 'mail',
'google-plus-1': 'google-plus-alt',
pinterest: 'pinterest-alt',
tumblr: 'tumblr-alt',
'jetpack-whatsapp': 'whatsapp',
'press-this': 'wordpress',
twitter: 'x',
more: 'share',
};
if ( ! this.props.button.custom ) {
const icon = shortnameToSocialLogo[ this.props.button.ID ] || this.props.button.shortname;
return