Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/pages/system/inventory/SledsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const staticCols = [
colHelper.accessor('id', {
cell: (info) => (
<LinkCell to={pb.sledInstances({ sledId: info.getValue() })}>
<Truncate text={info.getValue()} position="middle" className="max-w-48" />
<Truncate text={info.getValue()} position="middle" className="max-w-32" />
</LinkCell>
),
}),
Expand Down
16 changes: 4 additions & 12 deletions app/ui/lib/Truncate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,14 @@ export const Truncate = ({
{text}
</div>
) : (
<div
ref={ref}
aria-label={text}
className="relative overflow-hidden whitespace-nowrap"
>
<div ref={ref} aria-label={text} className="overflow-hidden whitespace-nowrap">
{/* invisible copy of the full text keeps the layout width stable, so
swapping in the shorter ellipsized text can't shrink the container
and trigger another round of truncation */}
<span aria-hidden className={cn(middleText && 'invisible')}>
<div aria-hidden className={cn(middleText && 'invisible h-0')}>
{text}
</span>
{middleText && (
<span aria-hidden className="absolute inset-0">
{middleText}
</span>
)}
</div>
{middleText && <div aria-hidden>{middleText}</div>}
</div>
)

Expand Down
Loading