feat(WEB-304): remaning UI from design system primitives
This commit is contained in:
@@ -30,6 +30,14 @@
|
||||
text-decoration: var(--typography-Body-Underlined-textDecoration);
|
||||
}
|
||||
|
||||
.textAlignCenter {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.textAlignLeft {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.black {
|
||||
/* No black variable exist yet */
|
||||
color: #000;
|
||||
|
||||
@@ -4,4 +4,6 @@ import type { VariantProps } from "class-variance-authority"
|
||||
|
||||
export interface BodyProps
|
||||
extends Omit<React.HTMLAttributes<HTMLHeadingElement>, "color">,
|
||||
VariantProps<typeof bodyVariants> {}
|
||||
VariantProps<typeof bodyVariants> {
|
||||
asChild?: boolean
|
||||
}
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
import { Slot } from "@radix-ui/react-slot"
|
||||
|
||||
import { bodyVariants } from "./variants"
|
||||
|
||||
import type { BodyProps } from "./body"
|
||||
|
||||
export default function Body({
|
||||
children,
|
||||
asChild = false,
|
||||
className = "",
|
||||
color,
|
||||
textAlign,
|
||||
textTransform,
|
||||
...props
|
||||
}: BodyProps) {
|
||||
const Comp = asChild ? Slot : "p"
|
||||
const classNames = bodyVariants({
|
||||
className,
|
||||
color,
|
||||
textAlign,
|
||||
textTransform,
|
||||
})
|
||||
return <p className={classNames}>{children}</p>
|
||||
return <Comp className={classNames} {...props} />
|
||||
}
|
||||
|
||||
@@ -9,6 +9,10 @@ const config = {
|
||||
burgundy: styles.burgundy,
|
||||
pale: styles.pale,
|
||||
},
|
||||
textAlign: {
|
||||
center: styles.textAlignCenter,
|
||||
left: styles.textAlignLeft,
|
||||
},
|
||||
textTransform: {
|
||||
bold: styles.bold,
|
||||
regular: styles.regular,
|
||||
@@ -17,6 +21,7 @@ const config = {
|
||||
},
|
||||
defaultVariants: {
|
||||
color: "black",
|
||||
textAlign: "left",
|
||||
textTransform: "regular",
|
||||
},
|
||||
} as const
|
||||
|
||||
Reference in New Issue
Block a user