-
Notifications
You must be signed in to change notification settings - Fork 3k
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 the error text style + add new hint prop to MenuItem component #41670
Conversation
@shawnborton I prepared a first look based on this #40697 discussions. Will be really helpful - if you can check - in which places we need to put hints inside the menu items - probably most of them are coming from QBO project. Reference from design works as well. Thanks! |
I think the rows found on expense views need to be fixed too, like this one for instance: Should look more like this one: Also, we have a similar project ongoing with Xero right now, so we should make sure those get updated too, cc @lakchote |
marginBottom: 4, | ||
}, | ||
|
||
formError: { | ||
color: theme.textError, | ||
fontSize: variables.fontSizeLabel, | ||
lineHeight: variables.formErrorLineHeight, | ||
lineHeight: variables.lineHeightNormal, |
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 is the value of this out of curiosity?
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.
@shawnborton
formErrorLineHeight - getValueUsingPixelRatio(18, 23),
lineHeightNormal: getValueUsingPixelRatio(16, 21),
what does getValuesUsingPixelRatio does:
Calculate the fontSize, lineHeight and padding when the device font size is changed, In most cases users do not change their device font size so PixelRatio.getFontScale() = 1 and this method always returns the defaultValue (first param). When the device font size increases/decreases, the PixelRatio.getFontScale() value increases/decreases as well. This means that if you have text and its 'fontSize' is 19, the device font size changed to the 5th level on the iOS slider and the actual fontSize is 19 * PixelRatio.getFontScale() = 19 * 1.11 = 21.09. Since we are disallowing font scaling we need to calculate it manually. We calculate it with: PixelRatio.getFontScale() * defaultValue > maxValue ? maxValue : defaultValue * PixelRatio.getFontScale() This means that the fontSize is increased/decreased when the device font size changes up to maxValue (second param)
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.
Got it. I mostly just think the naming convention feels strange, but that's a separate conversation I suppose.
For example, our "normal" font size is 15px, and it should have a line height of 20px. But it's strange that we call the 20px line height lineHeightLarge
Our "label" font size is 13px, and it should have a line height of 16px. But it's strange that we call the 16px line height lineHeightNormal
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.
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.
Oof, that hurts to look at. Anyways, nothing we need to worry about here, as long as we are using the right one for now.
@shawnborton updated expenses flow: @getusha can you please start checking PR. Thanks! |
Nice, and just to confirm, that's for all of the rows on that screen and not just merchant, right? |
yeah - it's using the same component |
Awesome, thank you for confirming |
@s77rt will start reviewing this, since he has a context from the related PR. |
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.
Do we still need both error
and errorText
? This is redundant, can we remove one of these props?
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.
yeah i will remove error props - it's not in correct position for menu item
That doesn't feel correct to me. I would think everything maintains it's same alignment, but the row becomes taller because now the error message is attached to the bottom. |
Yeah! Good point! When we have an error shown - we remove that min-height: 40px - because the menu item row - will be extremely big: That's why i remove that min-height to just allow menu item occupy needed space: Probably potential fix here can be - I can add padding top = 10px for chevron and red dot container (calculation min-height 40 px, each icon 20 px: 40 - 20 / 2 = 10px above and below.) Just let me know if that works - and i will apply this change! |
# Conflicts: # src/components/MenuItem.tsx
Correct, it should remain. |
Cool! that's how it will be look like @shawnborton : |
Perfect, thanks for confirming! |
Reviewer Checklist
Screenshots/Videos |
Do you know if we have a StoryBook component setup for MenuItem? |
@narefyev91, could you add more details on these steps? I didn't see any error when I change the country to USA |
@hayata-suenaga hey! In the point 3 of QA steps - it says that you need to go to User profile - but not to profile of workspace. Screen.Recording.2024-05-10.at.09.33.14.mov |
Yeah we already have it. src/stories/MenuItem.stories.tsx |
@hayata-suenaga Yes but for the MenuItems not the inputs, i.e. for the country field and state field if country is US (see screenshots in #41670 (comment)) |
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.
🟢
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
isHovered && !pressed && interactive ? StyleUtils.getBackgroundAndBorderStyle(theme.border) : undefined, | ||
]} | ||
/> | ||
<View style={[styles.flexColumn, styles.flex1]}> |
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.
this caused a regression #42171, there's a extra view wrapping the content, @narefyev91 was this intentional ?
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.
Raised a fix here #42178
🚀 Deployed to staging by https://github.com/hayata-suenaga in version: 1.4.74-0 🚀
|
menuItemError: { | ||
position: 'absolute', | ||
bottom: -4, | ||
left: 20, | ||
right: 20, | ||
marginTop: 4, | ||
marginBottom: 0, | ||
}, |
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.
Looks like this may have caused this error: #42209
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.4.74-6 🚀
|
Details
Refactor the error text style and add hint text inside menu item
Fixed Issues
$ #40697
PROPOSAL:
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
android.mov
Android: mWeb Chrome
android-web.mov
iOS: Native
ios.mov
iOS: mWeb Safari
ios-web.mov
MacOS: Chrome / Safari
MacOS: Desktop