Files
web/packages/design-system/lib/components/Caption/index.tsx
Rasmus Langvad d0546926a9 Merged in fix/3697-prettier-configs (pull request #3396)
fix(SW-3691): Setup one prettier config for whole repo

* Setup prettierrc in root and remove other configs


Approved-by: Joakim Jäderberg
Approved-by: Linus Flood
2026-01-07 12:45:50 +00:00

49 lines
1.0 KiB
TypeScript

import { Slot } from "@radix-ui/react-slot"
import { captionVariants, fontOnlycaptionVariants } from "./variants"
import { VariantProps } from "class-variance-authority"
interface CaptionProps
extends
Omit<React.HTMLAttributes<HTMLHeadingElement>, "color">,
VariantProps<typeof captionVariants> {
asChild?: boolean
fontOnly?: boolean
}
/**
* @deprecated Use `@scandic-hotels/design-system/Typography` instead.
*/
export default function Caption({
asChild = false,
className = "",
color,
fontOnly = false,
textAlign,
textTransform,
uppercase,
striked,
type,
...props
}: CaptionProps) {
const Comp = asChild ? Slot : "p"
const classNames = fontOnly
? fontOnlycaptionVariants({
className,
textTransform,
uppercase,
striked,
type,
})
: captionVariants({
className,
color,
textTransform,
textAlign,
uppercase,
striked,
type,
})
return <Comp className={classNames} {...props} />
}