mirror of
https://github.com/vercel/commerce.git
synced 2025-05-12 20:57:51 +00:00
33 lines
651 B
TypeScript
33 lines
651 B
TypeScript
import { VariantProps, tv } from 'tailwind-variants';
|
|
|
|
const text = tv(
|
|
{
|
|
base: '',
|
|
variants: {
|
|
size: {
|
|
sm: 'text-xs',
|
|
md: 'text-sm',
|
|
lg: 'text-md'
|
|
}
|
|
},
|
|
defaultVariants: {
|
|
size: 'md'
|
|
}
|
|
},
|
|
{
|
|
twMerge: false
|
|
}
|
|
);
|
|
|
|
export interface TextProps extends VariantProps<typeof text> {
|
|
className?: string;
|
|
children: React.ReactNode;
|
|
as?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'p';
|
|
}
|
|
|
|
export default function Text({ children, className, size, as }: TextProps) {
|
|
const Component = as || 'p';
|
|
|
|
return <Component className={text({ size, className })}>{children}</Component>;
|
|
}
|