Skip to content
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

feat(button): add circular shape as round #29161

Merged
merged 31 commits into from
Mar 21, 2024
Merged

feat(button): add circular shape as round #29161

merged 31 commits into from
Mar 21, 2024

Conversation

thetaPC
Copy link
Contributor

@thetaPC thetaPC commented Mar 13, 2024

Issue number: internal


What is the current behavior?

The round shape with only an icon will display a smaller value for the border radius.

Screenshot 2024-03-13 at 4 48 05 PM
Screenshot 2024-03-13 at 4 48 00 PM

What is the new behavior?

The round shape with only an icon will display as a circle.

  • The changes are made to md and ios.
  • The height for buttons have been updated to match iOS and MD designs.
    • iOS: small - 28px, regular - 34px, large - 50px
    • MD: small - 28px, regular - 40px, large - 50px
  • The icon size has been updated to match iOS and MD designs.
    • I had to calculate the sizes manually (overlapping native and ion-button) since Figma did not provide them.
  • The round test page has been updated to display all the possible options with shape="round".
  • The tests have been updated to track visual regressions for all the possible options with shape="round".

Screenshot 2024-03-19 at 1 13 41 PM
Screenshot 2024-03-19 at 1 13 35 PM

Does this introduce a breaking change?

  • Yes
  • No

N/A

Other information

Screenshots by components:

@github-actions github-actions bot added the package: core @ionic/core package label Mar 13, 2024
Comment on lines -238 to -240
::slotted(ion-icon[slot="icon-only"]) {
font-size: 1.8em;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed since the font size is being overwritten through their respective mode files.

@thetaPC thetaPC marked this pull request as ready for review March 15, 2024 19:40
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are going to have to implement this using min-width or aspect-ratio instead of adjusting the padding because the outline icons are wider than they are tall due to the borders.

@brandyscarney
Copy link
Member

Can you split the screenshots to a separate PR? I can't review the files without it freezing.

Copy link
Contributor

@sean-perkins sean-perkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR seems to be doing multiple things:

  1. Adds circle shape appearance to buttons.
  2. Updates the sizing of all buttons, creating many more diffs than specific to the feature we are adding.

It is possible I've been out of these conversations, but the recommended sizing was specific to circular buttons. Those haven't been reviewed or approved for buttons at whole.

We can take this to internal comms 👍

@@ -295,6 +305,10 @@ export class Button implements ComponentInterface, AnchorInterface, ButtonInterf
this.ionBlur.emit();
};

private slotChanged = () => {
this.isCircle = this.hasIconOnly;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

~ We should explain that we are using a state variable to trigger a re-render of the Stencil component when the slotted content changes, so that has-icon-only class is correctly applied.

I think moving that documentation here to enable the earlier documentation to be more focused on what isCircle is - a variable to track if the button should render as a circle shape or not.

Copy link
Contributor

@sean-perkins sean-perkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The button sizes do not appear to accurate to the PR description and design document. Can we double check those?

I checked locally against: http://localhost:3333/src/components/button/test/round on iOS all the sizes are ~2px smaller than expected.

core/src/components/button/button.ios.scss Outdated Show resolved Hide resolved
Copy link
Contributor

@sean-perkins sean-perkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The feature achieves the core requirements we aimed to accomplish and looks great, great work!

One question/potentially a follow up task we put in the backlog & refine:

The min clamping is great, we may want to consider what happens when the font size is too large:

CleanShot 2024-03-21 at 13 09 30

With the far right image, I've set the font size to 100px.

We hadn't considered this in the original design and I think it is a less common concern, so I'm fine with tackling that later.

Copy link
Contributor

@averyjohnston averyjohnston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh man the slotted buttons on inputs in ios mode look so much better now 😆 Thank you!

@thetaPC
Copy link
Contributor Author

thetaPC commented Mar 21, 2024

@sean-perkins I'll open a new PR for the font sizes. It should be up soon.

@thetaPC thetaPC merged commit 44529f0 into feature-8.0 Mar 21, 2024
42 checks passed
@thetaPC thetaPC deleted the FW-6017 branch March 21, 2024 18:49
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the correct value for the large icon only button? The icon is set to 1em which is smaller than the small and default button.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking into this now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brandyscarney this is correct. The large button has a font-size of 20px so the 1em is using that as the base. While the default has a font-size of 16px and small is 13px.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants