{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "card-testimonial",
  "title": "Card Testimonial",
  "description": "Card Testimonial, with rating, block quote, and author's informations.",
  "registryDependencies": [
    "https://systaliko-ui.vercel.app/r/default-avatar",
    "https://systaliko-ui.vercel.app/r/default-rating-stars",
    "https://systaliko-ui.vercel.app/r/default-card"
  ],
  "files": [
    {
      "path": "registry/cards/card-testimonial/index.tsx",
      "content": "'use client';\n\nimport { cn } from '@/lib/utils';\nimport { Avatar, AvatarFallback, AvatarImage } from '@/components/systaliko-ui/shadcn/avatar';\nimport { RatingStars } from '@/components/systaliko-ui/components/rating-stars';\nimport * as React from 'react';\nimport { Card, cardVariants } from '@/components/systaliko-ui/cards/card';\nimport { VariantProps } from 'class-variance-authority';\n\ninterface AuthorProps extends React.HTMLAttributes<HTMLDivElement> {\n  authorName: string;\n  avatarUrl?: string;\n  description?: string;\n}\ninterface CardTestimonialProps\n  extends React.HTMLAttributes<HTMLDivElement>,\n    VariantProps<typeof cardVariants> {\n  testimonialQuote: string;\n  testimonialAuthor: AuthorProps;\n  testimonialRating?: number;\n}\ninterface TestimonialContextValue {\n  testimonialQuote: string;\n  testimonialAuthor: AuthorProps;\n  testimonialRating?: number;\n}\n\nconst CardTestimonialContext = React.createContext<\n  TestimonialContextValue | undefined\n>(undefined);\n\nfunction useCardTestimonialContext() {\n  const context = React.useContext(CardTestimonialContext);\n  if (context === undefined) {\n    throw new Error(\n      'useCardTestimonialContext must be used within a CardTestimonialProvider',\n    );\n  }\n  return context;\n}\n\nexport const CardTestimonial = ({\n  testimonialQuote,\n  testimonialAuthor,\n  testimonialRating,\n  className,\n  children,\n  variant,\n  ...props\n}: CardTestimonialProps) => {\n  return (\n    <CardTestimonialContext.Provider\n      value={{ testimonialQuote, testimonialAuthor, testimonialRating }}\n    >\n      <Card className={cn(cardVariants({ variant, className }))} {...props}>\n        {children}\n      </Card>\n    </CardTestimonialContext.Provider>\n  );\n};\n\nexport const TestimonialAuthor = ({\n  className,\n  children,\n  ...props\n}: React.HTMLAttributes<HTMLDivElement>) => {\n  const { testimonialAuthor } = useCardTestimonialContext();\n  const { authorName, avatarUrl, description } = testimonialAuthor;\n  return (\n    <div className={className} {...props}>\n      <Avatar className=\"size-10\">\n        <AvatarImage src={avatarUrl} alt={`Portrait of ${authorName}`} />\n        <AvatarFallback>\n          {authorName\n            .split(' ')\n            .map((n) => n[0])\n            .join('')}\n        </AvatarFallback>\n      </Avatar>\n      <div>\n        <h4 className=\"block text-lg font-semibold tracking-tight md:text-xl\">\n          {authorName}\n        </h4>\n        <span className=\"block text-sm text-muted-foreground \">\n          {description}\n        </span>\n      </div>\n      {children}\n    </div>\n  );\n};\n\nexport const TestimonialRating = ({\n  className,\n  ...props\n}: React.HTMLAttributes<HTMLDivElement>) => {\n  const { testimonialRating } = useCardTestimonialContext();\n  return (\n    <RatingStars\n      className={className}\n      rating={testimonialRating ?? 0}\n      {...props}\n    />\n  );\n};\n\nexport const TestimonialQuote = ({\n  className,\n  ...props\n}: React.HTMLAttributes<HTMLQuoteElement>) => {\n  const { testimonialQuote } = useCardTestimonialContext();\n  return (\n    <blockquote className={className} {...props}>\n      {testimonialQuote}\n    </blockquote>\n  );\n};\n",
      "type": "registry:ui",
      "target": "components/systaliko-ui/cards/card-testimonial.tsx"
    }
  ],
  "type": "registry:ui"
}