Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------------------PARENT-------------------------------------------
- function Kittens({ litters }: KittensProps) {
- return (
- <>
- <div className="flex w-full flex-col items-center bg-zinc-100">
- <section className="mt-16 flex max-w-6xl flex-col gap-4 px-4 text-center">
- <h1 className="font-playfair text-4xl">
- <em>All Litters</em>
- </h1>
- <p className="text-base uppercase text-zinc-600"></p>
- <p className="text-base leading-loose text-zinc-500">
- A short presentation of our litters. <br />
- Click on their picture for further information.
- </p>
- </section>
- <section className="grid max-w-6xl auto-rows-fr gap-4 p-4 sm:grid-cols-2 sm:gap-6 md:grid-cols-3 md:gap-8">
- {litters.map((litter) => (
- <KittenProfile
- key={litter.id}
- id={litter.id}
- name={litter.name}
- post_image={litter.post_image ? litter.post_image : "placeholder"}
- slug={litter.slug}
- tags={JSON.parse(litter.tags)}
- />
- ))}
- </section>
- </div>
- <Footer />
- </>
- );
- }
- --------------------------------CHILD------------------------------------------
- export default function KittenProfile({
- id,
- name,
- post_image,
- slug,
- tags,
- }: KittenProfileProps) {
- return (
- <div className="relative flex flex-col overflow-hidden rounded-md bg-zinc-400">
- <Link href={`kittens/${slug}`}>
- {post_image !== "placeholder" && (
- <Image
- key={id}
- src={`/static/images/${post_image}`}
- alt={name}
- width={650}
- height={400}
- />
- )}
- <div className="absolute bottom-0 z-10 p-4 font-playfair uppercase tracking-wider text-white">
- <h3 className="text-sm">{tags.join(", ")}</h3>
- <h1 className="text-lg">{name}</h1>
- </div>
- <div className="absolute inset-0 bg-black opacity-40"></div>
- </Link>
- </div>
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment