import { clsx } from 'clsx'
export interface SpanProps extends React.ComponentPropsWithoutRef<'span'> {
variant?: 'default' | 'large' | 'small'
fontSize?: string
color?: string
fontFamily?: string
fontWeight?: string
fontStyle?: string
lineHeight?: string
textAlign?: string
margin?: string
className?: string
}
export function Span({
className = '',
variant = 'default',
fontSize = '',
color = '',
fontFamily = '',
fontWeight = '',
fontStyle = '',
lineHeight = '',
textAlign = '',
margin = '',
children,
...props
}: SpanProps) {
const variantFontSizes = {
default: 'text-lg',
large: 'text-lg md:text-xl',
small: 'text-sm',
}
const finalFontSize = fontSize || variantFontSizes[variant]
const finalColor = color || 'text-contrast'
const finalFontFamily = fontFamily || ''
const finalFontWeight = fontWeight || 'font-normal'
const finalFontStyle = fontStyle || ''
const finalLineHeight = lineHeight || 'leading-normal'
const finalTextAlign = textAlign || ''
const finalMargin = margin || 'mb-0'
return (
<span
className={clsx(
finalFontSize,
finalColor,
finalFontFamily,
finalFontWeight,
finalFontStyle,
finalLineHeight,
finalTextAlign,
finalMargin,
className
)}
{...props}
>
{children}
</span>
)
}