Merged in feat-StaticChip-component (pull request #3401)
feat: create new StaticChip component * feat: create new StaticChip componeny * refactor: remove deprecated Chip * fix: update type * refactor: remove div Approved-by: Erik Tiekstra
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import { Typography } from "../Typography"
|
||||
|
||||
import { variants } from "./variants"
|
||||
|
||||
import type { TypographyProps } from "../Typography/types"
|
||||
import type { VariantProps } from "class-variance-authority"
|
||||
import type { ReactNode } from "react"
|
||||
|
||||
import styles from "./chip-static.module.css"
|
||||
|
||||
type ChipStaticProps = {
|
||||
children: ReactNode
|
||||
className?: string
|
||||
lowerCase?: boolean
|
||||
} & VariantProps<typeof variants>
|
||||
|
||||
export function ChipStatic({
|
||||
className,
|
||||
color,
|
||||
size,
|
||||
lowerCase = false,
|
||||
children,
|
||||
}: ChipStaticProps) {
|
||||
const classNames = variants({ className, color, size })
|
||||
const typographyVariant = getTypographyVariant(lowerCase)
|
||||
|
||||
return (
|
||||
<Typography variant={typographyVariant}>
|
||||
<span className={classNames}>{children}</span>
|
||||
</Typography>
|
||||
)
|
||||
}
|
||||
|
||||
function getTypographyVariant(lowerCase: boolean): TypographyProps["variant"] {
|
||||
if (lowerCase) {
|
||||
return "Body/Supporting text (caption)/smRegular"
|
||||
}
|
||||
return "Tag/sm"
|
||||
}
|
||||
Reference in New Issue
Block a user