-
-
Notifications
You must be signed in to change notification settings - Fork 338
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
Fixed the misalignment in number text of money type cell #4097
Fixed the misalignment in number text of money type cell #4097
Conversation
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.
Sorry @sharath-1517, but this is not going to be a clean approach. We should keep the SteppedInputCell
component entirely decoupled from the concept of data types. Adding an isMoneyCell
prop couples it tightly to that data type and introduces mess that would be tricky to disentangle later on.
It's worth mentioning that this cell-level code is already super messy. It really is begging for a refactor, but we're not prioritizing that at the moment.
Notice how money cells and number cells are right aligned instead of left aligned? We should follow the same pattern when setting this new CSS.
-
Set the CSS within
CellWrapper
, and add a new prop to handle it. Name your prop in accordance with what is happening inside the component, not outside. So don't mention "money". I suggest a boolean prop nameduseTabularNumbers
which defaults tofalse
. Then a class with a similar name. -
Forward that prop up through
SteppedInputCell
. -
Set the prop to
true
within the respective components for Number, Money, Date, Date Time, Time, and Duration cell types.
@seancolsen I understand the issues very well and your other added information has made it really easier for me going ahead with this issue. I really appreciate your time and ideas. Thanks a lot! |
…to fix/numeric-cell-text-alignment
…esar into fix/numeric-cell-text-alignment
…ric, money, dateAndTime, time, duration, date)
Hey @seancolsen , I have added the guided changes. Requesting for a review. Thanks! |
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.
I pushed 4ec84e7 to properly handle Duration cells.
The code looks good to me now.
I'm going to hold off on merging since I'm not actually able to reproduce this issue the way Zack was. For me, all numbers render equally spaced, even before this PR. I suspect that the difference in observations between me and Zack is due to our systems using different fonts. Mathesar uses system fonts, so different users will see the UI with different fonts. That behavior is an intentional design choice. But it makes it somewhat tricky here. @zackkrida can you give this PR a whirl and see if it fixes the issue as you originally described it? If so, please merge. |
Excellent, this indeed fixes the issue. Thank you @sharath-1517! With the new CSS class disabled: With it enabled: In the font in use here, Canterell, the "1"s are a particularly good example of the change. |
d0bae78
Thank you Zach! |
Thanks Sean! |
Fixes #4085
Technical details
SteppedInputCell.svelte
component to make sure that only money fields will get the font-variant-numeric: tabular-nums;` style.Screenshots
Before:
After (See the decimal values):
Checklist
Update index.md
).develop
branch of the repositoryvisible errors.
Developer Certificate of Origin
Developer Certificate of Origin