mirror of
https://github.com/get-drexa/drive.git
synced 2025-11-30 21:41:39 +00:00
22 lines
512 B
TypeScript
22 lines
512 B
TypeScript
import { cn } from "@/lib/utils"
|
|
|
|
function MiddleTruncatedText({
|
|
children,
|
|
className,
|
|
}: {
|
|
children: string
|
|
className?: string
|
|
}) {
|
|
const LAST_PART_LENGTH = 3
|
|
const lastPart = children.slice(children.length - LAST_PART_LENGTH)
|
|
const firstPart = children.slice(0, children.length - LAST_PART_LENGTH)
|
|
return (
|
|
<p className={cn("max-w-full flex", className)}>
|
|
<span className="flex-1 truncate">{firstPart}</span>
|
|
<span className="w-min">{lastPart}</span>
|
|
</p>
|
|
)
|
|
}
|
|
|
|
export { MiddleTruncatedText }
|