Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#584 Share Icon for twitter added with some pre written text... #655

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/components/Card.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import React from "react";
import { motion } from "framer-motion";

import { BiSolidShareAlt } from "react-icons/bi";
const Card = ({ title, link, description, i, img }) => {
const handleShareClick = () => {
const tweetText = encodeURIComponent(
"Just stumbled upon an amazing free resource for learning programming! 🚀 Sharing the wealth of knowledge, check it out! 💻 Link :- https://web-resources-hub-project.vercel.app/" + " " + "#Programming #LearningJourney"
);
const twitterURL = `https://twitter.com/intent/tweet?text=${tweetText}`;
window.open(twitterURL, "_blank");
};

return (
<a href={link} target={"_blank"} rel="noreferrer">
<motion.div
Expand All @@ -11,6 +19,14 @@ const Card = ({ title, link, description, i, img }) => {
animate={{ opacity: 1, translateX: 0 }}
transition={{ duration: 0.2, delay: i * 0.2 }}
>
<div className="relative">
<button
className="twt-icon absolute top-0 right-0 -mt-2 -mr-2"
onClick={handleShareClick}
>
<BiSolidShareAlt />
</button>
</div>
<div className="img img-container self-center">
{/* src={`'${img}'`} */}
<img className="rounded-sm w-40 h-20" src={img} alt="img" />
Expand Down