2025-10-29 00:00:23 +00:00
|
|
|
import { cn } from "@/lib/utils"
|
|
|
|
|
|
|
|
|
|
function MiddleTruncatedText({
|
|
|
|
|
children,
|
|
|
|
|
className,
|
|
|
|
|
}: {
|
|
|
|
|
children: string
|
|
|
|
|
className?: string
|
|
|
|
|
}) {
|
2025-10-28 20:26:12 +00:00
|
|
|
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 (
|
2025-10-29 00:00:23 +00:00
|
|
|
<p className={cn("max-w-full flex", className)}>
|
2025-10-28 20:26:12 +00:00
|
|
|
<span className="flex-1 truncate">{firstPart}</span>
|
|
|
|
|
<span className="w-min">{lastPart}</span>
|
|
|
|
|
</p>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export { MiddleTruncatedText }
|