|
| 1 | +import { motion } from "framer-motion"; |
| 2 | +import Link from "next/link"; |
| 3 | +import { useState } from "react"; |
| 4 | +import Modal from "@/components/Modal"; |
| 5 | +import MediaCarousel from "@/components/MediaCarousel"; |
| 6 | +import Button from "@/components/Button"; |
| 7 | +import LinkButton from "@/components/LinkButton"; |
| 8 | +import Divider from "@/components/Divider"; |
| 9 | + |
| 10 | +export default function ExperienceCard({ url, title, fullDescription, cardDescription, cardImage, media, delay, gradient, myRole, timeline }: { url?: string, title: string, fullDescription: string[], cardDescription: string, cardImage: string, media: string[], delay: number, gradient: string, myRole: string, timeline: string }) { |
| 11 | + const [modalOpen, setModalOpen] = useState(false); |
| 12 | + |
| 13 | + return ( |
| 14 | + <> |
| 15 | + <motion.li |
| 16 | + className="group flex" |
| 17 | + initial={{ transform: 'translateY(-30px)', opacity: 0 }} |
| 18 | + whileInView={{ transform: 'translateY(0px)', opacity: 100 }} |
| 19 | + transition={{ duration: 0.5, delay: delay, ease: [0.39, 0.21, 0.12, 0.96], }} |
| 20 | + viewport={{ amount: 0.1, once: true }} |
| 21 | + > |
| 22 | + <div className={`p-4 flex md:flex-row flex-col gap-6 ${gradient} from-primary to-secondary rounded-lg border-1 border-accent shadow-2xl shadow-background items-center`}> |
| 23 | + <img alt="" draggable={false} className="rounded-lg md:h-[14rem] sm:h-[12rem] h-[10rem] duration-300" src={cardImage} /> |
| 24 | + <div className="flex flex-col"> |
| 25 | + <h2 className="md:text-left text-center font-semibold text-4xl"> |
| 26 | + {myRole} |
| 27 | + </h2> |
| 28 | + <h3 className="md:text-left text-center font-normal text-2xl"> |
| 29 | + {title} | <span className="brightness-75">{timeline}</span> |
| 30 | + </h3> |
| 31 | + <Divider /> |
| 32 | + <p className="md:text-left text-center text-lg mt-1"> |
| 33 | + {cardDescription} |
| 34 | + </p> |
| 35 | + <div className="flex row gap-4 mt-2"> |
| 36 | + {url && |
| 37 | + <LinkButton label="Visit Website" link={url} width="w-1/2" /> |
| 38 | + } |
| 39 | + <Button label="View More" onClick={() => setModalOpen(true)} width={`${url ? 'w-1/2' : 'w-full'}`} /> |
| 40 | + </div> |
| 41 | + </div> |
| 42 | + <Modal open={modalOpen} setOpen={setModalOpen}> |
| 43 | + <MediaCarousel media={media} /> |
| 44 | + <div className="flex lg:flex-row flex-col justify-between mt-6 px-3"> |
| 45 | + <div className="flex flex-col"> |
| 46 | + <div className="flex flex-row gap-2 items-center"> |
| 47 | + <h1 className="sm:text-4xl text-3xl font-bold">{title}</h1> |
| 48 | + {url && |
| 49 | + <Link href={url} target="_blank" className="bg-middle hover:bg-secondary duration-300 border-1 border-accent p-1.5 rounded-full"> |
| 50 | + <svg xmlns="http://www.w3.org/2000/svg" className="w-6 h-6 fill-white" viewBox="0 0 16 16"> |
| 51 | + <path d="M4.715 6.542 3.343 7.914a3 3 0 1 0 4.243 4.243l1.828-1.829A3 3 0 0 0 8.586 5.5L8 6.086a1 1 0 0 0-.154.199 2 2 0 0 1 .861 3.337L6.88 11.45a2 2 0 1 1-2.83-2.83l.793-.792a4 4 0 0 1-.128-1.287z" /> |
| 52 | + <path d="M6.586 4.672A3 3 0 0 0 7.414 9.5l.775-.776a2 2 0 0 1-.896-3.346L9.12 3.55a2 2 0 1 1 2.83 2.83l-.793.792c.112.42.155.855.128 1.287l1.372-1.372a3 3 0 1 0-4.243-4.243z" /> |
| 53 | + </svg> |
| 54 | + </Link> |
| 55 | + } |
| 56 | + </div> |
| 57 | + <div className="flex flex-col mt-2"> |
| 58 | + <h2 className="sm:text-2xl text-xl font-semibold">My Role</h2> |
| 59 | + <p className="sm:text-lg text-base">{myRole}</p> |
| 60 | + </div> |
| 61 | + <div className="flex flex-col mt-2"> |
| 62 | + <h2 className="sm:text-2xl text-xl font-semibold">Timeline</h2> |
| 63 | + <p className="sm:text-lg text-base">{timeline}</p> |
| 64 | + </div> |
| 65 | + </div> |
| 66 | + <div className="w-auto h-0.5 bg-accent rounded-lg lg:hidden block my-2" /> |
| 67 | + <div className="w-0.5 h-auto bg-accent rounded-lg lg:block hidden" /> |
| 68 | + <div className="flex flex-col"> |
| 69 | + <h2 className="sm:text-2xl text-xl font-semibold"> |
| 70 | + Overview |
| 71 | + </h2> |
| 72 | + <div className="max-h-[16.5rem] overflow-y-auto bg-neutral-800 border-1 border-accent rounded-lg p-2"> |
| 73 | + {fullDescription.map((desc, i) => ( |
| 74 | + <p key={i} className="sm:text-lg text-base first:mt-0 mt-2 max-w-[28rem]">{desc}</p> |
| 75 | + ))} |
| 76 | + </div> |
| 77 | + </div> |
| 78 | + </div> |
| 79 | + </Modal> |
| 80 | + </div> |
| 81 | + </motion.li> |
| 82 | + </> |
| 83 | + ); |
| 84 | +} |
0 commit comments