"use client" import { Card, CardContent, CardDescription, CardHeader, CardTitle, CardFooter } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { ComponentContainer } from "@/components/ui/component-container" import { SectionHeading } from "@/components/ui/section-heading" import { useMaterial } from "@/contexts/material-context" import { useTheme } from "next-themes" import { useMemo, useState } from "react" import { Heart, MessageCircle, Share2, Star } from "lucide-react" // Add minimal prop to the component interface CardsSectionProps { minimal?: boolean } export function CardsSection({ minimal = false }: CardsSectionProps) { const { selectedMaterial } = useMaterial() const { theme } = useTheme() const [liked, setLiked] = useState(false) const [bookmarked, setBookmarked] = useState(false) // Define card properties const cardProperties = [ { name: "variant", type: "select", options: ["default", "interactive", "profile", "feature", "pricing"], defaultValue: "default", label: "Card Type", description: "The type of card to display", }, { name: "title", type: "text", defaultValue: "Card Title", label: "Title", description: "The title of the card", }, { name: "description", type: "textarea", defaultValue: "Card description goes here", label: "Description", description: "The description text for the card", }, { name: "withFooter", type: "boolean", defaultValue: true, label: "Include Footer", description: "Whether to include a footer with actions", }, ] // Render card based on properties const renderCard = (props: Record) => { switch (props.variant) { case "interactive": return (
JD
{props.title} Product Designer

{props.description}

{props.withFooter && (
)}
) case "profile": return (
SW
{props.title} {props.description}
1.2k
Followers
847
Following
42
Projects
{props.withFooter && ( )}
) case "feature": return (
{props.title}

{props.description}

  • Advanced analytics dashboard
  • Priority customer support
{props.withFooter && ( )}
) case "pricing": return ( {props.title} {props.description}
$29 /month
  • Up to 10 team members
  • 100GB storage
{props.withFooter && ( )}
) default: return ( {props.title} {props.description}

This is a basic card component that can be used for various content types.

{props.withFooter && ( )}
) } } // Generate card code const generateCardCode = (props: Record) => { let code = `import { Card, CardContent, CardDescription, CardHeader, CardTitle${props.withFooter ? ", CardFooter" : ""} } from "@/components/ui/card"\n` switch (props.variant) { case "interactive": code += `import { Button } from "@/components/ui/button"\n` code += `import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"\n` code += `import { Heart, MessageCircle, Share2 } from 'lucide-react'\n\n` code += `\n` code += ` \n` code += `
\n` code += ` \n` code += ` \n` code += ` JD\n` code += ` \n` code += `
\n` code += ` ${props.title}\n` code += ` Product Designer\n` code += `
\n` code += `
\n` code += `
\n` code += ` \n` code += `

${props.description}

\n` code += `
\n` if (props.withFooter) { code += ` \n` code += `
\n` code += ` \n` code += ` \n` code += `
\n` code += ` \n` code += `
\n` } code += `
` break case "profile": code += `import { Button } from "@/components/ui/button"\n` code += `import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"\n\n` code += `\n` code += ` \n` code += `
\n` code += ` \n` code += ` \n` code += ` SW\n` code += ` \n` code += `
\n` code += ` ${props.title}\n` code += ` ${props.description}\n` code += `
\n` code += `
\n` code += `
\n` code += ` \n` code += `
\n` code += `
\n` code += `
1.2k
\n` code += `
Followers
\n` code += `
\n` code += `
\n` code += `
847
\n` code += `
Following
\n` code += `
\n` code += `
\n` code += `
42
\n` code += `
Projects
\n` code += `
\n` code += `
\n` code += `
\n` if (props.withFooter) { code += ` \n` code += ` \n` code += ` \n` } code += `
` break case "feature": code += `import { Button } from "@/components/ui/button"\n` code += `import { Star } from 'lucide-react'\n` code += `\n\n` code += ` \n` code += `
\n` code += `
\n` code += ` \n` code += `
\n` code += `
\n` code += ` ${props.title}\n` code += `
\n` code += `
\n` code += `
\n` code += ` \n` code += `

${props.description}

\n` code += `
    \n` code += `
  • \n` code += `
    \n` code += ` Advanced analytics dashboard\n` code += `
  • \n` code += `
  • \n` code += `
    \n` code += ` Priority customer support\n` code += `
  • \n` code += `
\n` code += `
\n` if (props.withFooter) { code += ` \n` code += ` \n` code += ` \n` } code += `
` break case "pricing": code += `import { Button } from "@/components/ui/button"\n` code += `\n\n` if (props.withFooter) { code += `
\n` code += ` Most Popular\n` code += `
\n` } code += ` \n` code += ` ${props.title}\n` code += ` ${props.description}\n` code += `
\n` code += ` $29\n` code += ` /month\n` code += `
\n` code += `
\n` code += ` \n` code += `
    \n` code += `
  • \n` code += `
    \n` code += ` \n` code += `
    \n` code += ` Up to 10 team members\n` code += `
  • \n` code += `
  • \n` code += `
    \n` code += ` \n` code += `
    \n` code += ` 100GB storage\n` code += `
  • \n` code += `
\n` code += `
\n` if (props.withFooter) { code += ` \n` code += ` \n` code += ` \n` } code += `
` break default: if (props.withFooter) { code += `import { Button } from "@/components/ui/button"\n\n` } code += `\n` code += ` \n` code += ` ${props.title}\n` code += ` ${props.description}\n` code += ` \n` code += ` \n` code += `

This is a basic card component that can be used for various content types.

\n` code += `
\n` if (props.withFooter) { code += ` \n` code += ` \n` code += ` \n` code += ` \n` } code += `
` } return code } // Check if the Glass material is selected const isGlassMaterial = useMemo(() => selectedMaterial?.name === "Glass", [selectedMaterial?.name]) // If minimal is true, return a simplified version if (minimal) { return (

Card

Card Title

Simple card example with minimal content.

) } return (
Card Title Card description goes here

This is a basic card component that can be used for various content types.

Border Radius Calculation

The card's border radius is calculated as: Inner Element Radius + Padding

  • • Small (p-3): 12px padding + 8px inner radius = 20px border radius
  • • Medium (p-4): 16px padding + 8px inner radius = 24px border radius
  • • Large (p-6): 24px padding + 8px inner radius = 32px border radius
{selectedMaterial && selectedMaterial.name === "Glass" && (

Material: When using the Glass material, cards will have a subtle transparency and backdrop blur effect while maintaining the calculated border radius.

)}
) }