-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: better TokenBalance #2068
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -141,3 +139,31 @@ function TokenBalanceContent({ | |||
</div> | |||
); | |||
} | |||
|
|||
function TokenBalanceActionButton({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this isn't used anywhere outside of TokenBalance I think it'd be better to call this ActionButton
or even Action
- TokenBalance
isn't really adding much
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense, i've renamed
import { formatUnits } from 'viem'; | ||
import type { TokenBalanceProps } from '../types'; | ||
|
||
export function TokenBalance({ | ||
token, | ||
onClick, | ||
onActionPress, | ||
actionText = 'Use max', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swap is just "max", should this match?
nit: title category should fall under chore, fix, feat, or docs.
|
/** Hide the token image */ | ||
showImage: false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
/** Hide the token image */ | |
showImage: false; | |
/** Hide the token image (default: false) */ | |
showImage: false; |
/** Hide the action button (default)*/ | ||
onActionPress?: never; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the default here? The code comment looks unfinished
@@ -141,3 +139,31 @@ function TokenBalanceContent({ | |||
</div> | |||
); | |||
} | |||
|
|||
function ActionButton({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts on putting ActionButton
and or TokenBalanceContent
in a separate file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like TokenBalanceContent
should be extracted
What changed? Why?
Notes to reviewers
How has it been tested?