Skip to content

Commit

Permalink
Fix token name cell (#45980)
Browse files Browse the repository at this point in the history
This will prevent long token names from causing the table to jitter when
hovered. After speaking with the design team, they preferred a wrapping
of the text instead of a scroll bar for long token names (to be
consistent with other tables).
  • Loading branch information
avatus authored Aug 29, 2024
1 parent e5e190f commit 04f6324
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions web/packages/teleport/src/JoinTokens/JoinTokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -325,25 +325,27 @@ const NameCell = ({ token }: { token: JoinToken }) => {
<Cell
align="left"
style={{
minWidth: '320px',
maxWidth: '320px',
fontFamily: 'monospace',
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
}}
onMouseEnter={() => setHovered(true)}
onMouseLeave={() => setHovered(false)}
>
<Flex alignItems="center" gap={2}>
<Text
css={`
text-overflow: clip;
overflow-x: auto;
overflow-wrap: break-word;
`}
>
{method !== 'token' ? id : safeName}
</Text>
{hovered && <CopyButton name={id} />}
<Box
css={`
visibility: ${hovered ? 'visible' : 'hidden'};
`}
>
<CopyButton name={id} />
</Box>
</Flex>
</Cell>
);
Expand Down

0 comments on commit 04f6324

Please sign in to comment.