src/components/paragraph.tsx
import { clsx } from 'clsx'
export interface ParagraphProps extends React.ComponentPropsWithoutRef<'p'> {
variant?: 'default' | 'large' | 'small'
fontSize?: string
color?: string | undefined
fontFamily?: string
fontWeight?: string
fontStyle?: string
lineHeight?: string
textAlign?: string
margin?: string
className?: string
}
export function Paragraph({
className = '',
variant = 'default',
fontSize = '',
color = '',
fontFamily = '',
fontWeight = '',
fontStyle = '',
lineHeight = '',
textAlign = '',
margin = '',
children,
...props
}: ParagraphProps) {
const variantFontSizes = {
default: 'text-base',
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-medium'
const finalFontStyle = fontStyle || ''
const finalLineHeight = lineHeight || 'leading-normal'
const finalTextAlign = textAlign || ''
const finalMargin = margin || 'mb-8'
return (
<p
className={clsx(
'content-wrapper',
'[&_a:not(.gallop-button)]:text-accent [&_a:not(.gallop-button)]:underline',
finalFontSize,
finalColor,
finalFontFamily,
finalFontWeight,
finalFontStyle,
finalLineHeight,
finalTextAlign,
finalMargin,
className
)}
{...props}
>
{children}
</p>
)
}
export { Paragraph as P }