feat: add className prop to MiddleTruncatedText

This commit is contained in:
2025-10-29 00:00:23 +00:00
parent 8f194eec55
commit 952a0e41b4

View File

@@ -1,9 +1,17 @@
function MiddleTruncatedText({ children }: { children: string }) { import { cn } from "@/lib/utils"
function MiddleTruncatedText({
children,
className,
}: {
children: string
className?: string
}) {
const LAST_PART_LENGTH = 3 const LAST_PART_LENGTH = 3
const lastPart = children.slice(children.length - LAST_PART_LENGTH) const lastPart = children.slice(children.length - LAST_PART_LENGTH)
const firstPart = children.slice(0, children.length - LAST_PART_LENGTH) const firstPart = children.slice(0, children.length - LAST_PART_LENGTH)
return ( return (
<p className="max-w-full flex"> <p className={cn("max-w-full flex", className)}>
<span className="flex-1 truncate">{firstPart}</span> <span className="flex-1 truncate">{firstPart}</span>
<span className="w-min">{lastPart}</span> <span className="w-min">{lastPart}</span>
</p> </p>