`import React, { useEffect, useState } from "react";
import {
Grid,
Typography,
makeStyles,
IconButton,
Button,
} from "@material-ui/core";
import { Link } from "react-router-dom";
import styles from "../DIseaseWithQues/styles";
import ShareArrow from "../../../assets/images/shareArrow.svg";
import whatsappShare from "../../../assets/images/whatsappShare.svg";
import twitterShare from "../../../assets/images/twitterShare.svg";
import facebookShare from "../../../assets/images/facebookShare.svg";
import instagramShare from "../../../assets/images/instagramShare.svg";
import shareClose from "../../../assets/images/shareClose.svg";
import { FacebookShareButton, InstapaperShareButton } from "react-share"
`import React, { useEffect, useState } from "react"; import { Grid, Typography, makeStyles, IconButton, Button, } from "@material-ui/core"; import { Link } from "react-router-dom"; import styles from "../DIseaseWithQues/styles"; import ShareArrow from "../../../assets/images/shareArrow.svg"; import whatsappShare from "../../../assets/images/whatsappShare.svg"; import twitterShare from "../../../assets/images/twitterShare.svg"; import facebookShare from "../../../assets/images/facebookShare.svg"; import instagramShare from "../../../assets/images/instagramShare.svg"; import shareClose from "../../../assets/images/shareClose.svg"; import { FacebookShareButton, InstapaperShareButton } from "react-share"
const useStyles = makeStyles((theme) => styles(theme));
const Share = () => { const classes = useStyles(); const [showSocial, setShowSocial] = useState(false); const[currentpageurl,setCurrentPageUrl]= useState("") const[currentpage,setCurrentPage] = useState("")
useEffect(() =>{ setCurrentPage(window.location.pathname) setCurrentPageUrl(window.location.href) },) console.log(window.location.pathname,"currentpageurl")
// const encode = ()=>{ // encodeURIComponent(currentpageurl) // replace("%[1-9]","") // }
const _whatsappShare = () => { window.open("https://web.whatsapp.com/send?text=/" + currentpageurl, "_blank") }
const _twitterShare = () => { window.open("https://twitter.com/intent/tweet?url=/" + currentpageurl, "_blank") }
const _fbShare = () => { window.open("https://www.facebook.com/sharer.php?u=/" + currentpageurl, "_blank") }
const _instaShare = () => { // window.open("https://www.instagram.com/send?text=" + currentpageurl, "_blank") window.open( "https://www.instagram.com/accounts/onetap/?next=" + "http://test-consumer.doctall.com" ); console.log(currentpageurl,"currentpageurl") }
return ( <> {showSocial ? ( console.log(showSocial,"showSocial"), <Grid item container className={classes.socialIcons} justifyContent="space-evenly" alignItems="center"
); };
export default Share; `