import { Slot } from "@radix-ui/react-slot"

import { captionVariants } from "./variants"

import type { CaptionProps } from "./caption"

export default function Caption({
  asChild = false,
  className = "",
  color,
  textTransform,
  ...props
}: CaptionProps) {
  const Comp = asChild ? Slot : "p"
  const classNames = captionVariants({
    className,
    color,
    textTransform,
  })
  return <Comp className={classNames} {...props} />
}
