Slide 46
Slide 46 text
interface IProps extends ITextCSSProps {
children: React.ReactNode;
className?: string;
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'strong' | 'p' | 'div' | 'i' | 'legend' | 'details' | 'footer' | 'summary';
id?: string;
onClick?: React.MouseEventHandler;
format?: boolean;
noOfLines?: INoOfLines;
center?: boolean;
target?: '_blank' | '_self';
'data-test'?: string;
'aria-label'?: string;
ellipsis?: boolean;
}
export default function Text({
children,
className,
as,
id,
color = 'darker-grey',
fontSize = 16,
fontWeight = 400,
format = false,
center = false,
noOfLines,
'data-test': dataTest,
onClick,
ellipsis,
...otherProps
}: IProps) {
const finalClassName = classNames(
dreamCSSClasses({ ...otherProps, color, fontSize, fontWeight, noOfLines }),
className,
format && styles.format,
center && styles.center,
ellipsis && styles.ellipsis,
);
const Component = as ?? 'div';
return (
{children}
);
}