alpinesmuseum-public/assets/js/components/AppContent/CIDetailView/DetailViewShare.js

43 lines
1.2 KiB
JavaScript

import React from 'react';
import DVLabel from './DVLabel';
import reduxLang from '../../../middleware/lang';
const DetailViewShare = ({ title, t }) => (
<div className='DetailViewShare'>
<DVLabel text={t('share')} />
<div className='DetailViewShare--items'>
<ShareItem
icon={<img src='/static/gfx/alps_fb.svg' alt='fb' />}
href={`http://www.facebook.com/sharer.php?u=${window.location.href}`}
/>
&nbsp; &nbsp;
<ShareItem
icon={<img src='/static/gfx/alps_twitter.svg' alt='tw' />}
href={`https://twitter.com/share?url=${window.location.href}&amp;text=${encodeURIComponent(
title
)}&amp;hashtags=alpinesmueum`}
/>
&nbsp; &nbsp;
<ShareItem
icon={<img src='/static/gfx/alps_mail.svg' alt='email' />}
href={`mailto:?subject=${title}&body=${window.location.href}`}
newTab={false}
/>
&nbsp; &nbsp;
<ShareItem
icon={<img src='/static/gfx/whatsapp.svg' alt='whatsapp' />}
href={`whatsapp://send?text=${window.location.href}`}
newTab={false}
/>
</div>
</div>
);
export default reduxLang('DVBody')(DetailViewShare);
const ShareItem = ({ icon, href, newTab = true}) => (
<a className='ShareItem' href={href} target={newTab ? '_blank' : ''}>
{icon}
</a>
);