Merged in chore/sw-3145-move-preamble (pull request #2519)
chore(SW-3145): Move Preamble to design-system * Move Preamble to design-system Approved-by: Linus Flood
This commit is contained in:
30
packages/design-system/lib/components/Preamble/index.tsx
Normal file
30
packages/design-system/lib/components/Preamble/index.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
import { Slot } from '@radix-ui/react-slot'
|
||||
|
||||
import { preambleVariants } from './variants'
|
||||
|
||||
import type { VariantProps } from 'class-variance-authority'
|
||||
|
||||
interface CaptionProps
|
||||
extends Omit<React.HTMLAttributes<HTMLHeadingElement>, 'color'>,
|
||||
VariantProps<typeof preambleVariants> {
|
||||
asChild?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use `Typography` instead.
|
||||
*/
|
||||
export default function Preamble({
|
||||
asChild = false,
|
||||
className = '',
|
||||
color,
|
||||
textAlign,
|
||||
...props
|
||||
}: CaptionProps) {
|
||||
const Comp = asChild ? Slot : 'p'
|
||||
const classNames = preambleVariants({
|
||||
className,
|
||||
color,
|
||||
textAlign,
|
||||
})
|
||||
return <Comp className={classNames} {...props} />
|
||||
}
|
||||
Reference in New Issue
Block a user