all repos — caroster @ f0c3499c510e22e9154bc07af8bf573603827d25

[Octree] Group carpool to your event https://caroster.io

frontend/containers/ShareEvent/index.tsx (view raw)

 1import Icon from '@mui/material/Icon';
 2import Button, {ButtonProps} from '@mui/material/Button';
 3import {useTranslation} from 'react-i18next';
 4import useShare from '../../hooks/useShare';
 5
 6interface Props {
 7  title: string;
 8}
 9
10const ShareEvent = ({title, sx}: ButtonProps & Props) => {
11  const {t} = useTranslation();
12  const {share, navigatorHasShareCapability} = useShare();
13
14  const text = navigatorHasShareCapability
15    ? t('event.fields.share')
16    : t('event.fields.copyLink');
17
18  return (
19    <Button
20      variant="outlined"
21      color="primary"
22      startIcon={<Icon>share</Icon>}
23      onClick={() => share({title})}
24      sx={sx}
25    >
26      {text}
27    </Button>
28  );
29};
30
31export default ShareEvent;