Skip to content
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

Add trailingZeros option to ValueView #1949

Merged
merged 3 commits into from
Dec 19, 2024
Merged

Conversation

JasonMHasperhoven
Copy link
Contributor

No description provided.

Copy link

changeset-bot bot commented Dec 17, 2024

🦋 Changeset detected

Latest commit: bd3995f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@penumbra-zone/ui Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Dec 17, 2024

Visit the preview URL for this PR (updated for commit bd3995f):

https://penumbra-ui-preview--pr1949-valueview-trailing-z-b3dlliw3.web.app

(expires Wed, 25 Dec 2024 14:23:38 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 709d729610ef7a6369b23f1cb2b820a60cc685b1

@JasonMHasperhoven JasonMHasperhoven requested a review from a team December 18, 2024 14:35
Copy link
Contributor

@grod220 grod220 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps next time the description would help, but could you give more detail on the use-case for this? Why are trailing zeros desirable in some cases?

@VanishMax
Copy link
Contributor

VanishMax commented Dec 19, 2024

I guess the reason for this is that toFormattedString's trailingZeros param is true by default. This options is not for adding trailing zeros but for removing them. If that is the case, I think we can type the param as trailingZeros?: false, since passing true does nothing.

Agree that it needs some more description

@grod220
Copy link
Contributor

grod220 commented Dec 19, 2024

If trailing zeros are never really desirable, how about we just set trailingZeroes on toFormattedString to false?

@JasonMHasperhoven
Copy link
Contributor Author

Oh sorry, here you can see in the design that we should 2 decimals for UM for example:
image

As Max mentioned, toFormattedString shows trailingZero's by default whereas toNumber does not.

@JasonMHasperhoven
Copy link
Contributor Author

And I still keep the default to false, as to keep the implementation the same as before (not changing it everywhere it's used)

@JasonMHasperhoven JasonMHasperhoven merged commit 6f74253 into main Dec 19, 2024
8 checks passed
@JasonMHasperhoven JasonMHasperhoven deleted the valueview-trailing-zeros branch December 19, 2024 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants