diff --git a/public/SocialMedia/Facebook_icon.png b/public/SocialMedia/Facebook_icon.png new file mode 100644 index 0000000..dcb874c Binary files /dev/null and b/public/SocialMedia/Facebook_icon.png differ diff --git a/public/SocialMedia/Twitter_icon.png b/public/SocialMedia/Twitter_icon.png new file mode 100644 index 0000000..eb76313 Binary files /dev/null and b/public/SocialMedia/Twitter_icon.png differ diff --git a/public/share_icon.svg b/public/share_icon.svg new file mode 100644 index 0000000..1ff5edb --- /dev/null +++ b/public/share_icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/Card.jsx b/src/components/Card.jsx index d659a9f..b2b064d 100644 --- a/src/components/Card.jsx +++ b/src/components/Card.jsx @@ -1,8 +1,22 @@ -import React from "react"; +import React, { useState } from "react"; import { motion } from "framer-motion"; +import ShareModal from "./ShareModal"; const Card = ({ title, link, description, i, img }) => { + + const [isModalActive, setIsModalActive] = useState(false) + + function shareHandler(e) { + e.preventDefault(); + setIsModalActive(!isModalActive) + } + + function closeModal(){ + setIsModalActive(!isModalActive) + } + return ( + <> { animate={{ opacity: 1, translateX: 0 }} transition={{ duration: 0.2, delay: i * 0.2 }} > -
+ + +
{/* src={`'${img}'`} */} - img +
+
+ img +
+
+ +
@@ -26,7 +48,17 @@ const Card = ({ title, link, description, i, img }) => {

+
+ {isModalActive ? + + : null } + + + + ); }; diff --git a/src/components/ShareModal.jsx b/src/components/ShareModal.jsx new file mode 100644 index 0000000..1a540a4 --- /dev/null +++ b/src/components/ShareModal.jsx @@ -0,0 +1,53 @@ +import React from 'react' +import { useState } from 'react' +import SocialMediaShareBtn from './socialmedia/SocialMediaShareBtn' + +const ShareModal = ({closeModal, link}) => { + + + const [animateClick, setAnimateClick] = useState(false) + + function Clicked(e) { + navigator.clipboard.writeText(link) + setAnimateClick(true) + + setTimeout ( () => { + setAnimateClick(false) + },150) + } + + return ( +
closeModal()} className='absolute top-0 left-0 w-full h-screen bg-grape-300 bg-opacity-40 flex justify-center items-center z-20 transition-all ease-out'> + +
+
+

Share

+ +
+ +
+ + + + +
+ + +
+

{link}

+ +
+
+ +
+ ) +} + +export default ShareModal diff --git a/src/components/socialmedia/SocialMediaShareBtn.jsx b/src/components/socialmedia/SocialMediaShareBtn.jsx new file mode 100644 index 0000000..f3dc3e4 --- /dev/null +++ b/src/components/socialmedia/SocialMediaShareBtn.jsx @@ -0,0 +1,15 @@ +import React from 'react' + +const SocialMediaShareBtn = ({socialMediaName,shareTo}) => { + return ( + +
+ + {`${socialMediaName} + +
{socialMediaName}
+
+ ) +} + +export default SocialMediaShareBtn diff --git a/src/index.css b/src/index.css index ac961a5..484c979 100644 --- a/src/index.css +++ b/src/index.css @@ -22,4 +22,16 @@ } .img-container img:hover { transform: scale(0.7); +} + +.text-white{ + color:white; +} + +.bg-gray-800{ + background-color: rgb(70,70,70); +} + +.animateClick { + background-color: rgb(130,130,130); } \ No newline at end of file