Skip to content
Snippets Groups Projects
Commit aa3db47f authored by Lucas Eduardo Schoenfelder's avatar Lucas Eduardo Schoenfelder
Browse files

share to fb/twitter added

parent 7c586baf
No related branches found
No related tags found
3 merge requests!57Merge of develop into master,!56Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...,!24Tela recurso
...@@ -16,7 +16,7 @@ GNU Affero General Public License for more details. ...@@ -16,7 +16,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License You should have received a copy of the GNU Affero General Public License
along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/
import React, {useContext, useRef} from 'react'; import React, {useRef} from 'react';
import { Button } from '@material-ui/core'; import { Button } from '@material-ui/core';
import Modal from '@material-ui/core/Modal'; import Modal from '@material-ui/core/Modal';
import Backdrop from '@material-ui/core/Backdrop'; import Backdrop from '@material-ui/core/Backdrop';
...@@ -33,14 +33,12 @@ import LinkIcon from '../img/link_icon.svg' ...@@ -33,14 +33,12 @@ import LinkIcon from '../img/link_icon.svg'
import CloseModalButton from './CloseModalButton.js' import CloseModalButton from './CloseModalButton.js'
export default function ReportModal (props) { export default function ReportModal (props) {
const pRef = useRef(props.link); const refContainer = useRef(props.link);
function copyToClipboard(e) { function copyToClipboard(e) {
console.log(pRef.current) let copyText = document.getElementById('p-text')
pRef.current.select(); console.log(copyText)
document.execCommand('copy'); };
e.target.focus();
};
return ( return (
<StyledModal <StyledModal
...@@ -72,22 +70,36 @@ export default function ReportModal (props) { ...@@ -72,22 +70,36 @@ export default function ReportModal (props) {
</ResourceInfo> </ResourceInfo>
<ShareInfo> <ShareInfo>
<Grid container style={{paddingRight : "15px", paddingLeft : "15px"}}> <Grid container style={{paddingRight : "15px", paddingLeft : "15px"}}>
{/*Share to facebook*/}
<Grid item xs={4}> <Grid item xs={4}>
<ShareButton> <a
<img src={Facebook} alt="facebook-logo"/> href={"https://www.facebook.com/sharer/sharer.php?u=" + props.link}
<p>FACEBOOK</p> target="_blank">
</ShareButton> <ShareButton>
<img src={Facebook} alt="facebook-logo"/>
<p>FACEBOOK</p>
</ShareButton>
</a>
</Grid> </Grid>
{/*Share to Twitter*/}
<Grid item xs={4}> <Grid item xs={4}>
<ShareButton> <a
<img src={Twitter} alt="twitter-logo"/> href={"https://www.twitter.com/intent/tweet?url=" + props.link}
<p>TWITTER</p> target="_blank">
</ShareButton> <ShareButton>
<img src={Twitter} alt="twitter-logo"/>
<p>TWITTER</p>
</ShareButton>
</a>
</Grid> </Grid>
{/*Get shareable link*/}
<Grid item xs={4}> <Grid item xs={4}>
<ShareButton onClick={copyToClipboard}> <ShareButton onClick={copyToClipboard}>
<img src={LinkIcon} alt="link-icon"/> <img src={LinkIcon} alt="link-icon"/>
<p ref={pRef} value={props.link}>COPIAR LINK</p> <p id="p-text" value={props.link}>COPIAR LINK</p>
</ShareButton> </ShareButton>
</Grid> </Grid>
</Grid> </Grid>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment