-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSocialLinks.js
More file actions
137 lines (129 loc) · 3.42 KB
/
SocialLinks.js
File metadata and controls
137 lines (129 loc) · 3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
import React from "react";
import { makeStyles } from "@material-ui/core/styles";
import {
EmailShareButton,
TwitterShareButton,
LinkedinShareButton,
PinterestShareButton,
RedditShareButton,
FacebookShareButton,
} from "react-share";
import {
FacebookIcon,
RedditIcon,
PinterestIcon,
TwitterIcon,
MoreItemsIcon,
LinkedInIcon,
EmailIcon,
} from "../../../assets/icons";
import { Typography, Grid, IconButton, Popover } from "@material-ui/core";
const useStyles = makeStyles((theme) => ({
root: {
display: "flex",
flexDirection: "row",
justifyContent: "flex-end",
alignItems: "center",
textAlign: "center",
alignContent: "center",
},
drawerPaper: {
borderRadius: "10px",
borderWidth: "3px",
borderColor: theme.palette.primary.main,
borderStyle: "solid",
textAlign: "center",
padding: theme.spacing(2, 4),
},
}));
const StyledPopover = (props) => (
<Popover
anchorOrigin={{
vertical: "bottom",
horizontal: "right",
}}
transformOrigin={{
vertical: "top",
horizontal: "right",
}}
{...props}
/>
);
export default function SocialLinks(props) {
const classes = useStyles();
const [anchorEl, setAnchorEl] = React.useState(null);
const handleClick = (event) => {
setAnchorEl(event.currentTarget);
};
const handleClose = () => {
setAnchorEl(null);
};
const open = Boolean(anchorEl);
const id = open ? "simple-popover" : undefined;
return (
<>
<Grid container direction="row" className={classes.root} spacing={1}>
<Grid item>
<Typography className={classes.url} variant="overline">
Share{" "}
</Typography>
</Grid>
<Grid item>
<EmailShareButton url={window.location.href}>
<EmailIcon height="15" width="20" />
</EmailShareButton>
</Grid>
<Grid item>
<TwitterShareButton url={window.location.href}>
<TwitterIcon fill="#1DA1F2" height="14" width="18" />
</TwitterShareButton>
</Grid>
<Grid item>
<LinkedinShareButton url={window.location.href}>
<LinkedInIcon />
</LinkedinShareButton>
</Grid>
<Grid item>
<IconButton aria-describedby={id} onClick={handleClick}>
<MoreItemsIcon />
</IconButton>
<StyledPopover
id={id}
open={open}
anchorEl={anchorEl}
onClose={handleClose}
PaperProps={{
className: classes.drawerPaper,
}}
>
<Grid
container
direction="row"
className={classes.root}
spacing={2}
>
<Grid item>
<PinterestShareButton
url={window.location.href}
media={props.coverImage}
>
<PinterestIcon />
</PinterestShareButton>
</Grid>
<Grid item>
<RedditShareButton url={window.location.href}>
<RedditIcon />
</RedditShareButton>
</Grid>
<Grid item>
<FacebookShareButton url={window.location.href}>
<FacebookIcon />
</FacebookShareButton>
</Grid>
</Grid>
</StyledPopover>
</Grid>
</Grid>
</>
);
}