all repos — caroster @ e3dd820256e0c4ea2c317a33c8fc29f9a83f3711

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

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

 1import Button, {ButtonProps} from '@mui/material/Button';
 2import {useTranslation} from 'next-i18next';
 3import useShare from '../../hooks/useShare';
 4import Box from '@mui/material/Box';
 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    <Box textAlign="center" width={1}>
20      <Button
21        variant="outlined"
22        color="primary"
23        onClick={() => share({title})}
24        sx={sx}
25      >
26        {text}
27      </Button>
28    </Box>
29  );
30};
31
32export default ShareEvent;