|
| 1 | +"use client" |
| 2 | +import Link from "next/link" |
| 3 | +import { useState } from "react" |
| 4 | +import { motion } from "motion/react" |
| 5 | +import { Separator } from "@/ui/separator" |
| 6 | +import { cardVariants } from "@/ui/motion-config/card.motion" |
| 7 | +import { SegmentAnimation } from "@/ui/motion/segment" |
| 8 | +import { communityCards } from "@/lib/content" |
| 9 | + |
| 10 | +export const CommunitySection = () => { |
| 11 | + const [hovered, setHovered] = useState<number | null>(null) |
| 12 | + return ( |
| 13 | + <section> |
| 14 | + <Separator index={1}>Get Involved</Separator> |
| 15 | + <section className="mx-10 border-x border-solid border-border base:mx-16 lg:min-h-[calc(100dvh-4rem)] lg:flex lg:flex-col"> |
| 16 | + <SegmentAnimation |
| 17 | + title="Ways to Contribute" |
| 18 | + description="Tailwind CSS v4 brings a modern engine — and our utilities are built for it. We’ve designed every package to integrate seamlessly using the new configuration API, variant generator, and dynamic styling support." |
| 19 | + /> |
| 20 | + <div className="grid text-primary text-left a:border-t a:border-solid a:border-border lg:flex-100 lg:grid-cols-3 lg:a:border-r lg:a:nth-[3]:border-r-0 lg:a:nth-[5]:border-r-0 lg:a:nth-[4]:col-span-2 xl:min-h-[30dvw] xl:a:nth-[2]:border-r"> |
| 21 | + {communityCards.map((item, idx) => ( |
| 22 | + <Link href={item.href} key={item.number} target="_blank" rel="noopener noreferrer"> |
| 23 | + <motion.article |
| 24 | + key={item.number} |
| 25 | + className="group w-full h-full py-14 px-4 flex items-center justify-between gap-x-6 relative z-10 overflow-hidden sm:px-6 sm:gap-x-10 md:px-8 md:gap-x-12 base:px-10 base:gap-x-16 lg:flex-col lg:items-start hover:bg-surface hover:cursor-pointer" |
| 26 | + onMouseEnter={() => setHovered(idx)} |
| 27 | + onMouseLeave={() => setHovered(null)} |
| 28 | + transition={cardVariants} |
| 29 | + > |
| 30 | + <span>{item.number}</span> |
| 31 | + <div className="w-full text-right self-end overflow-hidden base:text-left"> |
| 32 | + <p className="text-lg font-medium group-hover:text-primary">{item.title}</p> |
| 33 | + <motion.p |
| 34 | + className="mt-1 text-muted overflow-hidden group-hover:text-primary" |
| 35 | + animate={ |
| 36 | + hovered === idx |
| 37 | + ? { opacity: 1, y: 0, height: "auto" } |
| 38 | + : { opacity: 0, y: 20, height: 0 } |
| 39 | + } |
| 40 | + initial={{ opacity: 0, y: 20, height: 0 }} |
| 41 | + transition={{ duration: 0.4, ease: [0.4, 0, 0.2, 1] }} |
| 42 | + > |
| 43 | + {item.desc} |
| 44 | + </motion.p> |
| 45 | + </div> |
| 46 | + </motion.article> |
| 47 | + </Link> |
| 48 | + ))} |
| 49 | + </div> |
| 50 | + </section> |
| 51 | + </section> |
| 52 | + ) |
| 53 | +} |
0 commit comments