"use client" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { useMaterial } from "@/contexts/material-context" import { cn } from "@/lib/utils" import { useMemo } from "react" import { SectionHeading } from "@/components/ui/section-heading" import { ComponentContainer } from "@/components/ui/component-container" import { getActualValue } from "@/utils/component-properties" // Add minimal prop to the component interface AvatarsSectionProps { minimal?: boolean } export function AvatarsSection({ minimal = false }: AvatarsSectionProps) { const { selectedMaterial, getMaterialClass } = useMaterial() const materialClass = useMemo(() => { return selectedMaterial && getMaterialClass ? getMaterialClass(selectedMaterial) : "" }, [selectedMaterial, getMaterialClass]) // Define avatar properties const avatarProperties = [ { name: "size", type: "select", options: ["Default", "Small", "Large", "Extra Large"], defaultValue: "default", label: "Size", description: "The size of the avatar", }, { name: "src", type: "select", options: ["None", "/avatar-woman-1.jpg", "/avatar-man-1.jpg", "/avatar-woman-2.jpg", "/avatar-man-2.jpg"], defaultValue: "/avatar-woman-1.jpg", label: "Image Source", description: "The source URL of the avatar image", }, { name: "fallback", type: "text", defaultValue: "JD", label: "Fallback Text", description: "Text to display when the image fails to load", }, { name: "showFallback", type: "boolean", defaultValue: false, label: "Force Fallback", description: "Force the fallback to be displayed instead of the image", }, { name: "border", type: "boolean", defaultValue: false, label: "Show Border", description: "Add a border around the avatar", }, ] // Render avatar based on properties const renderAvatar = (props: Record) => { const actualSize = getActualValue(props.size) const actualSrc = getActualValue(props.src) const sizeClasses = { default: "h-10 w-10", sm: "h-8 w-8", lg: "h-14 w-14", xl: "h-20 w-20", } const sizeClass = sizeClasses[actualSize as keyof typeof sizeClasses] || sizeClasses.default const borderClass = props.border ? "border-2 border-primary" : "" const elevationClass = "shadow-sm" // Add level 1 elevation return ( {!props.showFallback && actualSrc !== "none" && ( )} {props.fallback} ) } // Generate avatar code const generateAvatarCode = (props: Record) => { const actualSize = getActualValue(props.size) const actualSrc = getActualValue(props.src) const sizeClasses = { default: "h-10 w-10", sm: "h-8 w-8", lg: "h-14 w-14", xl: "h-20 w-20", } const sizeClass = sizeClasses[actualSize as keyof typeof sizeClasses] || sizeClasses.default const borderClass = props.border ? "border-2 border-primary" : "" const elevationClass = "shadow-sm" // Add level 1 elevation const className = [sizeClass, borderClass, elevationClass].filter(Boolean).join(" ") let code = `import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"\n\n` code += `\n` if (!props.showFallback && actualSrc !== "none") { code += ` \n` } code += ` ${props.fallback}\n` code += `` return code } // Update the minimal version to use h3 if (minimal) { return (

Avatar

A
B
C
) } return (
JD SJ MC `} >
SJ MC LR DK
JD AB `} >
JD AB CK MR
A B C +2
`} >
A B C +2

Usage

            {`import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"`}
          
) }