1
0
mirror of synced 2025-12-22 03:16:52 -05:00
Files
docs/components/ui/TruncateLines/TruncateLines.tsx
Peter Bengtsson 67dc3ac7cd remove need for styled-jsx construct (#28749)
* remove need for styled-jsx construct

* remove line that might not be needed
2022-06-28 11:53:35 +00:00

21 lines
541 B
TypeScript

import React, { ReactNode } from 'react'
import cx from 'classnames'
import styles from './TruncateLines.module.scss'
export type TruncateLinesPropsT = {
as?: keyof JSX.IntrinsicElements
maxLines: number
children: ReactNode
className?: string
}
export const TruncateLines = (props: TruncateLinesPropsT) => {
const { maxLines, className, children, as: Component = 'div' } = props
return (
<Component className={cx(styles.truncated, className)} style={{ WebkitLineClamp: maxLines }}>
{children}
</Component>
)
}