digital-gardeners/components/Card.js

49 lines
1.6 KiB
JavaScript
Raw Normal View History

2021-09-05 16:37:21 +02:00
import { motion } from "framer-motion";
import Link from "next/link";
import Image from "next/image";
export default function Card({ garden }) {
2021-09-05 16:37:21 +02:00
return (
<motion.li
2021-09-06 17:36:23 +02:00
className="w-80 mr-8 mb-8 space-y-2 opacity-80"
key={garden.filePath}
2021-09-05 16:37:21 +02:00
whileHover={{
scale: 1.02,
opacity: 1,
transition: {
duration: 0.3,
ease: "easeInOut",
},
}}
>
<Link
as={`${garden.filePath.replace(/\.mdx?$/, "")}`}
2021-09-06 16:41:00 +02:00
href={`[slug]`}
2021-09-05 16:37:21 +02:00
>
<a>
{garden.data.image && (
2021-09-05 16:37:21 +02:00
<Image
className="rounded-md"
src={garden.data.image}
2021-09-06 17:36:23 +02:00
width={320}
height={180}
layout="responsive"
alt={garden.data.title}
2021-09-05 16:37:21 +02:00
/>
)}
2021-09-06 17:36:23 +02:00
<h3 className=" leading-tight mt-4 text-lg">
{garden.data.title}
2021-09-05 16:37:21 +02:00
</h3>
</a>
</Link>
<motion.div>
{garden.data.tools &&
garden.data.tools.map((tool) => <p>{tool}</p>)}
2021-09-05 16:37:21 +02:00
</motion.div>
2021-09-06 17:36:23 +02:00
<svg className="h-4 w-4 " viewBox="0 0 20 20">
2021-09-05 16:37:21 +02:00
<path d="M12.95 10.707l.707-.707L8 4.343 6.586 5.757 10.828 10l-4.242 4.243L8 15.657l4.95-4.95z" />
</svg>
</motion.li>
);
}