|
| 1 | +import React from "react"; |
| 2 | +import Image from "next/image"; |
| 3 | + |
| 4 | +import Button from "@/components/UI/Button.component"; |
| 5 | +import { urlFor } from "@/lib/sanity/helpers"; |
| 6 | +import BounceInScroll from "../Animations/BounceInScroll.component"; |
| 7 | + |
| 8 | +interface ProjectProps { |
| 9 | + name: string; |
| 10 | + description: string; |
| 11 | + subdescription: string; |
| 12 | + projectimage: string; |
| 13 | + urlwww: Array<{ url: string; _key: string }>; |
| 14 | + urlgithub: Array<{ url: string; _key: string }>; |
| 15 | +} |
| 16 | + |
| 17 | +const ProsjektCard: React.FC<ProjectProps> = ({ |
| 18 | + name, |
| 19 | + description, |
| 20 | + subdescription, |
| 21 | + projectimage, |
| 22 | + urlwww, |
| 23 | + urlgithub, |
| 24 | +}) => { |
| 25 | + return ( |
| 26 | + <div className="bg-slate-700 shadow-md rounded-lg overflow-hidden mx-4 md:m-0"> |
| 27 | + <BounceInScroll viewAmount={0.3}> |
| 28 | + <div className="relative w-full h-48 md:h-60"> |
| 29 | + <div className="w-full h-full p-5 md:pb-[50px] relative overflow-hidden flex justify-center md:w-[750px] md:h-[350px]"> |
| 30 | + {projectimage && ( |
| 31 | + <Image |
| 32 | + className="flex justify-center text-center" |
| 33 | + width="600" |
| 34 | + height="350" |
| 35 | + quality={100} |
| 36 | + src={urlFor(projectimage).url() as string} |
| 37 | + alt={name} |
| 38 | + priority |
| 39 | + unoptimized |
| 40 | + /> |
| 41 | + )} |
| 42 | + </div> |
| 43 | + </div> |
| 44 | + <div className="md:mt-12 p-2 flex flex-col justify-between min-h-[250px] xl:min-h-[275px]"> |
| 45 | + <div> |
| 46 | + <h1 className="xl:mt-4 text-xl text-center font-bold py-2 text-slate-200"> |
| 47 | + {name} |
| 48 | + </h1> |
| 49 | + <h2 className="text-md">{description}</h2> |
| 50 | + <p className="mt-4 text-sm mt-2">{subdescription}</p> |
| 51 | + </div> |
| 52 | + <div className="flex justify-center mt-4"> |
| 53 | + {urlwww && urlwww.length > 0 && ( |
| 54 | + <Button href={urlwww[0].url} renderAs="a"> |
| 55 | + Besøk |
| 56 | + </Button> |
| 57 | + )} |
| 58 | + {urlgithub && urlgithub.length > 0 && ( |
| 59 | + <Button href={urlgithub[0].url} renderAs="a"> |
| 60 | + GitHub |
| 61 | + </Button> |
| 62 | + )} |
| 63 | + </div> |
| 64 | + </div> |
| 65 | + </BounceInScroll> |
| 66 | + </div> |
| 67 | + ); |
| 68 | +}; |
| 69 | + |
| 70 | +export default ProsjektCard; |
0 commit comments