Open m-natarajan opened 2 weeks ago
Triggered auto assignment to @twisterdotcom (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
We need to update the icon size for icon-only buttons to match the icon size used in our regular buttons.
UI Enhancements
To achieve this, we can remove the hasText
condition, which was initially added intentionally. Removing this will ensure consistency between buttons with and without text.
For sizing of height and width:
Small: Use iconSizeExtraSmall
Medium: Use iconSizeSmall
Large: Use iconSizeNormal
Edited by proposal-police: This proposal was edited at 2024-10-23 19:06:30 UTC.
Icon-only buttons are 4px larger in width and height than regular buttons with both text and an icon.
The extra 4px is added due to the logic in this part of the code, where the hasText argument is being used to increase the button's dimensions when no text is present: https://github.com/Expensify/App/blob/3ddc1dd1c1475d65ed4a49e4ebf2cc57b8fa0108/src/styles/utils/index.ts#L493.
Modify the getIconWidthAndHeightStyle function:
case small:
return {width: variables.iconSizeExtraSmall, height: variables.iconSizeExtraSmall};
case medium:
return {width: variables.iconSizeSmall, height: variables.iconSizeSmall};
case large:
return {width: variables.iconSizeNormal, height: variables.iconSizeNormal};
2. Delete the hasText prop from the IconProps definition here: :
https://github.com/Expensify/App/blob/0c3996be52f8dd4b7ce13fe2983411795a6429d0/src/components/Icon/index.tsx#L44
3.Don't accept the hasText prop in the Icon component https://github.com/Expensify/App/blob/0c3996be52f8dd4b7ce13fe2983411795a6429d0/src/components/Icon/index.tsx#L44.
4. Remove the hasText prop when passing it to the Icon component in this part of the code:
https://github.com/Expensify/App/blob/0c3996be52f8dd4b7ce13fe2983411795a6429d0/src/components/Button/index.tsx#L294-L298
5. remove the hasText from this function calling:
https://github.com/Expensify/App/blob/0c3996be52f8dd4b7ce13fe2983411795a6429d0/src/components/Icon/index.tsx#L74
Job added to Upwork: https://www.upwork.com/jobs/~021849243090532893090
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rojiphil (External
)
Edited by proposal-police: This proposal was edited at 2024-10-23 19:06:30 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Icon-only buttons are 4px larger in width and height than regular buttons with both text and an icon.
What is the root cause of that problem?
Specifically, the CSS or design system may have different size definitions or padding for icons in icon-only buttons, causing them to render 4px larger.
What changes do you think we should make in order to solve the problem?
To solve the problem of inconsistent icon sizes in the icon-only buttons, the following changes should be made:
1. Standardize Icon Sizing: Ensure that the same size is applied to icons in both icon-only buttons and regular buttons. Check the CSS properties like >font-size or width and height for the icons in both button types and make sure they match.
2. Adjust Padding/Margins: If the size discrepancy is caused by extra padding or margins around the icons in icon-only buttons, adjust these properties to >match those used in regular buttons.
3. Use a Consistent Class or Style: Apply a shared class for icon styling that ensures uniform size across all buttons. This way, any updates to icon sizes will be >reflected consistently in both types of buttons.
4. Test Across Button Sizes: After applying changes, test the buttons across different sizes (small, medium, large) to confirm the icons are properly scaled >and consistent.
These changes should ensure the icons in all buttons have the same size.
📣 @VinitRadadiya! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Contributor details Your Expensify account email: vinit25radadiya@gmail.com Upwork Profile Link: https://www.upwork.com/freelancers/~01f3e2273d4d6b87c9
⚠️ Missing/invalid email or upwork profile link. Please make sure you add both your Expensify email and Upwork profile link in the format specified.
Contributor details Your Expensify account email: vinit25radadiya@gmail.com Upwork Profile Link: https://www.upwork.com/freelancers/~01f3e2273d4d6b87c9
Adding some more detail in case it's helpful:
Our regular buttons use some special padding values when there's an icon present. For icon-only buttons the padding is more straight-forward:
We do not want to make any changes to how are regular buttons / buttons with icon + text are displayed. Only for buttons with just an icon.
Thanks for the context, Danny. I’ve tested the small, medium, and large icon-only buttons after applying the changes, and they match the styles you mentioned here. It looks like what’s shown in the attached video.
https://github.com/user-attachments/assets/55221bf9-56b1-469d-8109-3dd6ad5e3ba2
@Shahidullah-Muffakir Your proposal has more implementation details but isn’t it essentially the same as @jayeshmangwani proposal?
The implementation details make more sense when there is logic involved but no logical implementation is needed to remove the hastText
implementation and to apply the correct variables.
@rojiphil , Thank you for asking. I agree that the core change aligns with what @jayeshmangwani suggested. However, my proposal includes detailed implementation steps to ensure clarity and avoid any potential issues during execution. The reason I provided these details is that in few proposals in other issues, the ones with more implementation specifics were preferred, but I believe that if the initial proposal includes the essential changes, the additional details will naturally follow in the pull request (PR). For example, removing the hasText prop and its type is necessary; otherwise, the PR will fail linting and TypeScript tests.
So, I concur that if the first proposal captures the main changes, we can proceed with it even without extensive implementation details, as those adjustments are expected to be made in the PR. Given this perspective, I am fine if you proceed with the @jayeshmangwani's proposal.
Thanks again, and as a friendly suggestion, I think it would be helpful to apply this approach consistently across all issues going forward.
I concur that if the first proposal captures the main changes, we can proceed with it even without extensive implementation details, as those adjustments are expected to be made in the PR
@Shahidullah-Muffakir This is precisely the point. The key aspect of reviewing proposals for me is to look for a distinct advantage over other proposals. Extensive implementation details for something like remove hasText implementation
do not give a distinct advantage as that can be figured out in PR. But if the main changes involve multiple logical possibilities, I would like to see more implementation details in the proposal. Thanks for your proposal though. Hopefully, we can work together on some other issue.
@jayeshmangwani proposal LGTM as we can apply the required iconSize
variables and remove the hasText
implementation.
🎀👀🎀 C+ reviewed
Triggered auto assignment to @mjasikowski, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Proposal looks good!
📣 @rojiphil 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: Reproducible in staging?: Reproducible in production?: If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: @dannymcclain Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1729695613695369
Action Performed:
Expected Result:
Update the icon size in icon-only buttons to use the same size
Actual Result:
Currently, the icons in icon-only buttons are 4px larger than in our regular buttons of the same size
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
![image](https://github.com/user-attachments/assets/8c2a7c2a-b616-4378-93fb-10fb89b594f3)View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @rojiphil