-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
feature: add props isSplit to button with dropdown #40278
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
@@ -115,6 +115,9 @@ type ButtonProps = Partial<ChildrenProps> & { | |||
|
|||
/** Boolean whether to display the right icon */ | |||
shouldShowRightIcon?: boolean; | |||
|
|||
/** The custom icon to display to the right of the text */ | |||
customRightIcon?: React.ReactNode; |
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'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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@luacmartins i just updated code, please check again 🙏
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.
Left another comment about the additional Icon prop
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.
We're close
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.
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 |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 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-mweb.mov
iOS: Native
ios.mov
iOS: mWeb Safari
ios-mweb.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov