Guest User

Untitled

a guest
Aug 23rd, 2023
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ---------------------------PARENT-------------------------------------------
  2. function Kittens({ litters }: KittensProps) {
  3.   return (
  4.     <>
  5.       <div className="flex w-full flex-col items-center bg-zinc-100">
  6.         <section className="mt-16 flex max-w-6xl flex-col gap-4 px-4 text-center">
  7.           <h1 className="font-playfair text-4xl">
  8.             <em>All Litters</em>
  9.           </h1>
  10.           <p className="text-base uppercase text-zinc-600"></p>
  11.           <p className="text-base leading-loose text-zinc-500">
  12.             A short presentation of our litters. <br />
  13.             Click on their picture for further information.
  14.           </p>
  15.         </section>
  16.         <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">
  17.           {litters.map((litter) => (
  18.             <KittenProfile
  19.               key={litter.id}
  20.               id={litter.id}
  21.               name={litter.name}
  22.               post_image={litter.post_image ? litter.post_image : "placeholder"}
  23.               slug={litter.slug}
  24.               tags={JSON.parse(litter.tags)}
  25.             />
  26.           ))}
  27.         </section>
  28.       </div>
  29.       <Footer />
  30.     </>
  31.   );
  32. }
  33. --------------------------------CHILD------------------------------------------
  34. export default function KittenProfile({
  35.   id,
  36.   name,
  37.   post_image,
  38.   slug,
  39.   tags,
  40. }: KittenProfileProps) {
  41.  
  42.   return (
  43.     <div className="relative flex flex-col overflow-hidden rounded-md bg-zinc-400">
  44.       <Link href={`kittens/${slug}`}>
  45.         {post_image !== "placeholder" && (
  46.           <Image
  47.             key={id}
  48.             src={`/static/images/${post_image}`}
  49.             alt={name}
  50.             width={650}
  51.             height={400}
  52.           />
  53.         )}
  54.         <div className="absolute bottom-0 z-10 p-4 font-playfair uppercase tracking-wider text-white">
  55.           <h3 className="text-sm">{tags.join(", ")}</h3>
  56.           <h1 className="text-lg">{name}</h1>
  57.         </div>
  58.         <div className="absolute inset-0 bg-black opacity-40"></div>
  59.       </Link>
  60.     </div>
  61.   );
  62. }
  63.  
Advertisement
Add Comment
Please, Sign In to add comment