199 |
stevensc |
1 |
import React from "react";
|
|
|
2 |
import { openShareModal } from "../../../../redux/share-modal/shareModal.actions";
|
|
|
3 |
import { shareModalTypes } from "../../../../redux/share-modal/shareModal.types";
|
|
|
4 |
import { useDispatch, useSelector } from "react-redux";
|
|
|
5 |
import styled from "styled-components";
|
|
|
6 |
|
|
|
7 |
import Avatar from "@mui/material/Avatar";
|
|
|
8 |
import ImageIcon from "@mui/icons-material/Image";
|
|
|
9 |
import CreateIcon from "@mui/icons-material/Create";
|
|
|
10 |
import ArticleIcon from "@mui/icons-material/Article";
|
|
|
11 |
import PostAddIcon from "@mui/icons-material/PostAdd";
|
|
|
12 |
import SubscriptionsIcon from "@mui/icons-material/Subscriptions";
|
|
|
13 |
|
|
|
14 |
import Input from "../../../UI/Input";
|
|
|
15 |
import ShareOption from "./ShareOption";
|
|
|
16 |
|
|
|
17 |
import styles from "./ShareComponent.module.scss";
|
|
|
18 |
|
|
|
19 |
const StyledInput = styled(Input)`
|
|
|
20 |
border: 1px solid lightgray;
|
|
|
21 |
background-color: #fff;
|
|
|
22 |
border-radius: 30px;
|
|
|
23 |
padding: 5px;
|
|
|
24 |
padding-left: 1rem;
|
|
|
25 |
flex: 1;
|
|
|
26 |
cursor: pointer;
|
|
|
27 |
|
|
|
28 |
&:hover {
|
|
|
29 |
background-color: rgba(0, 0, 0, 0.08);
|
|
|
30 |
}
|
|
|
31 |
`;
|
|
|
32 |
|
|
|
33 |
const ShareComponent = ({ feedType, postUrl = "", image = "" }) => {
|
|
|
34 |
const labels = useSelector(({ intl }) => intl.labels);
|
|
|
35 |
const dispatch = useDispatch();
|
|
|
36 |
|
|
|
37 |
const onClickHandler = (postType) => {
|
|
|
38 |
dispatch(openShareModal(postUrl, postType, feedType));
|
|
|
39 |
};
|
|
|
40 |
|
|
|
41 |
return (
|
|
|
42 |
<div className={styles.share__container}>
|
|
|
43 |
<div className={styles.input__container}>
|
|
|
44 |
<Avatar src={image} sx={{ width: "50px", height: "50px" }} />
|
|
|
45 |
|
|
|
46 |
<StyledInput
|
|
|
47 |
type="text"
|
|
|
48 |
readOnly
|
|
|
49 |
icon={CreateIcon}
|
|
|
50 |
placeholder={labels.what_are_you_thinking}
|
|
|
51 |
onClick={() => onClickHandler(shareModalTypes.POST)}
|
|
|
52 |
/>
|
|
|
53 |
</div>
|
|
|
54 |
|
|
|
55 |
<div className={styles.share__options}>
|
|
|
56 |
<ShareOption
|
|
|
57 |
icon={ImageIcon}
|
|
|
58 |
title={labels.image}
|
|
|
59 |
color="#7405f9"
|
|
|
60 |
onClick={() => onClickHandler(shareModalTypes.IMAGE)}
|
|
|
61 |
/>
|
|
|
62 |
<ShareOption
|
|
|
63 |
icon={SubscriptionsIcon}
|
|
|
64 |
title={labels.video}
|
|
|
65 |
color="#E7A33E"
|
|
|
66 |
onClick={() => onClickHandler(shareModalTypes.VIDEO)}
|
|
|
67 |
/>
|
|
|
68 |
<ShareOption
|
|
|
69 |
icon={ArticleIcon}
|
|
|
70 |
title={labels.document}
|
|
|
71 |
color="#C0C8CD"
|
|
|
72 |
onClick={() => onClickHandler(shareModalTypes.FILE)}
|
|
|
73 |
/>
|
|
|
74 |
<ShareOption
|
|
|
75 |
icon={PostAddIcon}
|
|
|
76 |
title={labels.write}
|
|
|
77 |
color="#7FC15E"
|
|
|
78 |
onClick={() => onClickHandler(shareModalTypes.POST)}
|
|
|
79 |
/>
|
|
|
80 |
</div>
|
|
|
81 |
</div>
|
|
|
82 |
);
|
|
|
83 |
};
|
|
|
84 |
|
|
|
85 |
export default ShareComponent;
|