Skip to content

Commit

Permalink
fix: Hide reset nonce button (#2223)
Browse files Browse the repository at this point in the history
* fix: Hide reset nonce button

* Use ch units instead of em, absolute positioned reset button
  • Loading branch information
usame-algan authored Jul 4, 2023
1 parent 7575033 commit f7d521e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
29 changes: 14 additions & 15 deletions src/components/tx-flow/common/TxNonce/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,24 +136,23 @@ const TxNonceForm = ({ nonce, recommendedNonce }: { nonce: number; recommendedNo
InputProps={{
...params.InputProps,
name: field.name,
endAdornment: (
<InputAdornment position="end" className={css.adornment}>
<Tooltip title="Reset to recommended nonce">
<IconButton
onClick={resetNonce}
size="small"
color="primary"
disabled={readOnly || recommendedNonce.toString() === field.value}
>
<RotateLeftIcon fontSize="small" />
</IconButton>
</Tooltip>
</InputAdornment>
),
endAdornment:
!readOnly && recommendedNonce.toString() !== field.value ? (
<InputAdornment position="end" className={css.adornment}>
<Tooltip title="Reset to recommended nonce">
<IconButton onClick={resetNonce} size="small" color="primary">
<RotateLeftIcon fontSize="small" />
</IconButton>
</Tooltip>
</InputAdornment>
) : null,
readOnly,
}}
className={css.input}
sx={{ width: `${field.value.length}em`, minWidth: '5em', maxWidth: '200px' }}
title={field.value}
sx={{
minWidth: `clamp(1ch, ${field.value.length}ch, 200px)`,
}}
/>
</Tooltip>
)
Expand Down
4 changes: 3 additions & 1 deletion src/components/tx-flow/common/TxNonce/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

.input input {
font-weight: bold;
padding-right: 6px !important;
padding-right: 30px !important;
}

.adornment {
margin-left: 0;
margin-right: 4px;
position: absolute;
right: 0;
}

0 comments on commit f7d521e

Please sign in to comment.