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 all commits
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
51 changes: 30 additions & 21 deletions src/components/Card.jsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
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
className="card border-b-2 bg-gradient-to-r from-[#545454] to-[#807f7f] border-b-[#000000] flex flex-col rounded-lg gap-4 p-4 shadow-3xl h-[16rem] w-[24rem] hover:shadow-4xl "
key={i}
initial={{ opacity: 0, translateX: -100 }}
animate={{ opacity: 1, translateX: 0 }}
transition={{ duration: 0.2, delay: i * 0.2 }}
>
<div className="img img-container self-center">
{/* src={`'${img}'`} */}
<img className="rounded-sm w-40 h-20" src={img} alt="img" />
</div>

<div className="content flex flex-col gap-4 items-center">
<h2 className="text-[#e5e5e5] hover:text-[#fff] text-lg font-bold hover:text-orange-500">
{title}
</h2>

<p className="text-[0.9rem] text-[#e2e1e1] w-4/5 font-inter tracking-wide leading-5">
{description.slice(0, 120) + "..."}
</p>
<div className="h-[20rem]">
<div className="relative w-64 border bg-[#cacaca] border-gray-300 rounded-lg shadow-md shadow-black-100 overflow-hidden transform transition-transform hover:scale-105 hover:bg-[#e2e1e1] hover:shadow-black-100">
<div className="relative">
<img
src={img}
alt={title}
className="w-full h-32 object-cover transform transition-transform hover:scale-110"
/>
<div className="absolute top-2 right-2">
<BiSolidShareAlt onClick={handleShareClick} className="h-6 w-6 text-[#cacaca] hover:text-blue-500 cursor-pointer" />
</div>
</div>
<div className="p-4">
<h3 className="text-xl font-semibold mb-2">{title}</h3>
<p className="text-white-600">
{description.slice(0, 120) + "..."}
</p>
</div>
</div>
</motion.div>
</div>
</a>
);
};
Expand Down