feature: add props isSplit to button with dropdown#40278
feature: add props isSplit to button with dropdown#40278luacmartins merged 11 commits intoExpensify:mainfrom
Conversation
|
@abdulrahuman5196 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@abdulrahuman5196 Please help to review the PR when you have a chance. |
|
Hi, Got stuck. Will review within one day. |
src/components/Button/index.tsx
Outdated
| shouldShowRightIcon?: boolean; | ||
|
|
||
| /** The custom icon to display to the right of the text */ | ||
| customRightIcon?: React.ReactNode; |
There was a problem hiding this comment.
I'm not sure that I'm following this. We already have an iconRight prop, can't we just reuse that and shouldShowRightIcon?
There was a problem hiding this comment.
In this case we need pass a custom style right icon
because: in custom icon we have style
medium={isButtonSizeLarge}
small={!isButtonSizeLarge}
but with default right icon we have style
large={isButtonSizeLarge}
medium={!isButtonSizeLarge}
There was a problem hiding this comment.
I'm still not sure that I follow. I don't think we should add another Icon prop just to use different styles. Can we just compare the sizes instead?
large={buttonSize === CONST.DROPDOWN_BUTTON_SIZE.LARGE}
medium={buttonSize === CONST.DROPDOWN_BUTTON_SIZE.MEDIUM}
small={buttonSize === CONST.DROPDOWN_BUTTON_SIZE.SMALL}
There was a problem hiding this comment.
@luacmartins The current style of the button and the style of the icon are not consistent:
- when the button has a size of large, the icon only has a size of medium
- when the button has a size other than large, it has a small size
So we can't just compare the sizes.
There was a problem hiding this comment.
So are you saying that when we have a split button, the logic should be:
large={isButtonSizeLarge}
medium={!isButtonSizeLarge}
but for non-split buttons it's supposed to be:
large={isButtonSizeLarge}
medium={!isButtonSizeLarge}
Is that right? If so, I think we can derive those from a combination of isSplitButton and the button size.
There was a problem hiding this comment.
@luacmartins i just updated code, please check again 🙏
luacmartins
left a comment
There was a problem hiding this comment.
Left another comment about the additional Icon prop
luacmartins
left a comment
There was a problem hiding this comment.
LGTM. Could you also use the new split button in the new SearchFiltersNarrow page, please?
|
@nkdengineer lint is also failing |
result.mov@luacmartins this is result when i use the new split button in the new SearchFiltersNarrow page |
|
Looks good, but we need the left icon too. Does this button not support that? |
|
@luacmartins Currently, the button only supports the right icon and does not have logic support for left icon |
|
@nkdengineer ok, let's leave it as is then, sorry about the distraction |
|
@abdulrahuman5196 all yours |
|
Sorry about the delay. Will work on review. |
|
Checking now |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-04-29.at.8.28.24.PM.mp4Android: mWeb ChromeScreen.Recording.2024-04-29.at.8.29.59.PM.mp4iOS: NativeScreen.Recording.2024-04-29.at.8.24.07.PM.mp4iOS: mWeb SafariScreen.Recording.2024-04-29.at.8.26.17.PM.mp4MacOS: Chrome / SafariScreen.Recording.2024-04-29.at.8.10.37.PM.mp4MacOS: DesktopScreen.Recording.2024-04-29.at.8.15.45.PM.mp4 |
abdulrahuman5196
left a comment
There was a problem hiding this comment.
Changes looks good and works well. Reviewers checklist is also complete.
All yours. @luacmartins
🎀 👀 🎀
C+ Reviewed
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Cherry-picked to staging by https://github.com/francoisl in version: 1.4.67-7 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 1.4.68-0 🚀
|
|
🚀 Cherry-picked to staging by https://github.com/francoisl in version: 1.4.67-7 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.4.68-3 🚀
|
| ref={(ref) => { | ||
| caretButton.current = ref; | ||
| }} |
There was a problem hiding this comment.
This caused style regression
More details (root cause & solution): #46127 (comment)
| ref={buttonRef} | ||
| onPress={(event) => onPress(event, selectedItem.value)} | ||
| ref={(ref) => { | ||
| caretButton.current = ref; |
There was a problem hiding this comment.
This PR caused a bug - Tapping Pay button in an invoice crashes the app
Fixed here - #44919 (comment)
| <Icon | ||
| src={iconRight} | ||
| fill={iconFill ?? (success || danger ? theme.textLight : theme.icon)} | ||
| small={medium} |
There was a problem hiding this comment.
why was it set like that? is there any specific reason? Right now I need to add small icon handling and I'll adjust it in this way:
small={small}
medium={medium}
large={large}
may it broke something?
@nkdengineer
Details
Fixed Issues
$ #39832
PROPOSAL: #39832 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
android.mov
Android: mWeb Chrome
android-mweb.mov
iOS: Native
ios.mov
iOS: mWeb Safari
ios-mweb.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov