Skip to content

Commit

Permalink
Revert "Fixed the social media icon fucntonality"
Browse files Browse the repository at this point in the history
This reverts commit e8d0256.
  • Loading branch information
wilsonfurtado2000 committed Feb 15, 2024
1 parent e8d0256 commit 6b813f0
Showing 1 changed file with 22 additions and 55 deletions.
77 changes: 22 additions & 55 deletions src/components/Profile/SocialIcons/SocialIcons.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import LinkedInIcon from "@mui/icons-material/LinkedIn";
import GitHubIcon from "@mui/icons-material/GitHub";
import TwitterIcon from "@mui/icons-material/Twitter";
import LinkIcon from "@mui/icons-material/Link";
import { useSelector } from "react-redux";


const useStyles = makeStyles(theme => ({
root: {
Expand All @@ -34,65 +32,34 @@ const useStyles = makeStyles(theme => ({

export default function SocialIcons(props) {
const classes = useStyles();
const profileData = useSelector(({ firebase: { profile } }) => profile);

console.log(profileData)

const openSocialMediaLink = (link) => {
window.open(link, "_blank");
};


const copyPageUrlToClipboard = () => {
const pageUrl = window.location.href;
navigator.clipboard.writeText(pageUrl)
.then(() => {
alert("Profile link copied to clipboard!");
})
.catch((error) => {
console.error("Error copying page URL to clipboard:", error);
});
};

return (
<Card className={classes.root}>
<CardActions className={classes.icon} disableSpacing>
{profileData?.link_facebook != "" &&
<IconButton
color="primary"
aria-label="share"
data-testId="FacebookIcon"
onClick={() => openSocialMediaLink(`https://facebook.com/${profileData.link_facebook}`)}
>
<FacebookIcon className={classes.facebookIcon} />
</IconButton>
}
{profileData?.link_linkedin != "" &&
<IconButton
<IconButton
color="primary"
aria-label="share"
data-testId="FacebookIcon"
>
<FacebookIcon className={classes.facebookIcon} />
</IconButton>
<IconButton
color="primary"
aria-label="share"
data-testId="LinkedInIcon"
onClick={() => openSocialMediaLink(`https://linkedin.com/in/${profileData.link_linkedin}`)}
>
<LinkedInIcon className={classes.linkedInIcon} />
</IconButton>
}
{profileData?.link_github != "" &&
<IconButton aria-label="share" onClick={() => openSocialMediaLink(`https://github.com/${profileData.link_github}`)} data-testId="GithubIcon">
<GitHubIcon className={classes.blackIcon} />
</IconButton>
}
{profileData?.link_twitter != "" &&
<IconButton
color="primary"
aria-label="add to favorites"
data-testId="TwitterIcon"
onClick={() => openSocialMediaLink(`https://twitter.com/${profileData.link_twitter}`)}
>
<TwitterIcon className={classes.twitterIcon} />
</IconButton>
}
<IconButton onClick={copyPageUrlToClipboard} aria-label="share" data-testId="LinkIcon">
>
<LinkedInIcon className={classes.linkedInIcon} />
</IconButton>
<IconButton aria-label="share" data-testId="GithubIcon">
<GitHubIcon className={classes.blackIcon} />
</IconButton>
<IconButton
color="primary"
aria-label="add to favorites"
data-testId="TwitterIcon"
>
<TwitterIcon className={classes.twitterIcon} />
</IconButton>
<IconButton aria-label="share" data-testId="LinkIcon">
<LinkIcon className={classes.blackIcon} />
</IconButton>
</CardActions>
Expand Down

0 comments on commit 6b813f0

Please sign in to comment.