update
This commit is contained in:
16
apps/admin.saladeaula.digital/app/components/abbr.tsx
Normal file
16
apps/admin.saladeaula.digital/app/components/abbr.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
type AbbrProps = {
|
||||
children: string
|
||||
maxLen?: number
|
||||
}
|
||||
|
||||
export function Abbr({ children, maxLen = 30, ...props }: AbbrProps) {
|
||||
if (children.length <= maxLen) {
|
||||
return <abbr {...props}>{children}</abbr>
|
||||
}
|
||||
|
||||
return (
|
||||
<abbr title={children} {...props}>
|
||||
{children.substring(0, maxLen).concat('...')}
|
||||
</abbr>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user