Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.53k stars 2.88k forks source link

[$250] Update the icon size in icon-only buttons to match the icon size in our regular buttons #51355

Open m-natarajan opened 2 weeks ago

m-natarajan commented 2 weeks ago

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:

  1. Go to staging.new.expensify.com
  2. Observe the icon-only buttons

    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?

    • [ ] Android: Standalone
    • [ ] Android: HybridApp
    • [ ] Android: mWeb Chrome
    • [ ] iOS: Standalone
    • [ ] iOS: HybridApp
    • [ ] iOS: mWeb Safari
    • [x] MacOS: Chrome / Safari
    • [ ] MacOS: Desktop

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
  • Upwork Job URL: https://www.upwork.com/jobs/~021849243090532893090
  • Upwork Job ID: 1849243090532893090
  • Last Price Increase: 2024-10-24
  • Automatic offers:
    • rojiphil | Reviewer | 104658121
Issue OwnerCurrent Issue Owner: @rojiphil
melvin-bot[bot] commented 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.

jayeshmangwani commented 2 weeks ago

Proposal

Please re-state the problem that we are trying to solve in this issue.

We need to update the icon size for icon-only buttons to match the icon size used in our regular buttons.

What is the root cause of that problem?

UI Enhancements

What changes do you think we should make in order to solve the problem?

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

https://github.com/Expensify/App/blob/3ddc1dd1c1475d65ed4a49e4ebf2cc57b8fa0108/src/styles/utils/index.ts#L493-L503

What alternative solutions did you explore? (Optional)

Shahidullah-Muffakir commented 2 weeks ago

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?

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.

What changes do you think we should make in order to solve the problem?

  1. Modify the getIconWidthAndHeightStyle function:

    1. Remove the hasText argument from the function signature.
    2. Return the button's width and height purely based on the button size, ignoring the hasText condition. The updated logic should look like this:
      
      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
melvin-bot[bot] commented 2 weeks ago

Job added to Upwork: https://www.upwork.com/jobs/~021849243090532893090

melvin-bot[bot] commented 2 weeks ago

Triggered auto assignment to Contributor-plus team member for initial proposal review - @rojiphil (External)

VinitRadadiya commented 2 weeks ago

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.

melvin-bot[bot] commented 2 weeks ago

📣 @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:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
VinitRadadiya commented 2 weeks ago

Contributor details Your Expensify account email: vinit25radadiya@gmail.com Upwork Profile Link: https://www.upwork.com/freelancers/~01f3e2273d4d6b87c9

melvin-bot[bot] commented 2 weeks ago

⚠️ Missing/invalid email or upwork profile link. Please make sure you add both your Expensify email and Upwork profile link in the format specified.

VinitRadadiya commented 2 weeks ago

Contributor details Your Expensify account email: vinit25radadiya@gmail.com Upwork Profile Link: https://www.upwork.com/freelancers/~01f3e2273d4d6b87c9

dannymcclain commented 2 weeks ago

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.

jayeshmangwani commented 2 weeks ago

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

rojiphil commented 1 week ago

@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.

Shahidullah-Muffakir commented 1 week ago

@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.

rojiphil commented 1 week ago

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.

rojiphil commented 1 week ago

@jayeshmangwani proposal LGTM as we can apply the required iconSize variables and remove the hasText implementation. 🎀👀🎀 C+ reviewed

melvin-bot[bot] commented 1 week ago

Triggered auto assignment to @mjasikowski, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

mjasikowski commented 1 week ago

Proposal looks good!

melvin-bot[bot] commented 1 week ago

📣 @rojiphil 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link Upwork job