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

Reduced default ToggleSwitch's height to 24px #2363

Closed
wants to merge 27 commits into from
Closed

Conversation

smmr-dn
Copy link
Contributor

@smmr-dn smmr-dn commented Dec 6, 2024

Changes

Originally, the ToggleSwitch checkmark icon of class iui-toggle-switch-icon had the margin setup of iui-size-m (16px; 8px each) with an additional of 1px on each side ($iui-toggle-switch-border-thickness).

On top of that, the content class iui-toggle-switch's block-size was specified by the addition of --_iui-toggle-switch-handle-size (16px) + --_iui-toggle-switch-handle-offset * 2 (8px) + $iui-toggle-switch-border-thickness * 2 (2px) which resulted in 26px.

Therefore, the block-size has been reduced in this PR to reduce the height from 26px to 24px while maintaining the icons' size to be 16px for medium (default size).

Testing

Screenshots containing ToggleSwitch with this change have been approved.

Docs

Added two changesets.

@smmr-dn smmr-dn marked this pull request as ready for review December 9, 2024 19:42
@smmr-dn smmr-dn requested a review from a team as a code owner December 9, 2024 19:42
@smmr-dn smmr-dn requested review from mayank99 and r100-stack and removed request for a team December 9, 2024 19:42
Copy link
Contributor

@mayank99 mayank99 left a comment

Choose a reason for hiding this comment

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

This has again changed the height of the regular size ToggleSwitch. Only the small one should be affected.

Edit: Actually it's the opposite: only the regular one should be affected. See later comment.

@smmr-dn
Copy link
Contributor Author

smmr-dn commented Dec 10, 2024

This has again changed the height of the regular size ToggleSwitch. Only the small one should be affected.

I just double checked and realized that there are two sizes for ToggleSwitch: small 18px and medium (default) 26px, which have now been reduced to 16px and 24px. Were these supposed to be 16px and 24px instead of 18px and 26px? Most of the examples/stories use the default medium size, I believe that might be why it affects the other screenshots.

@smmr-dn smmr-dn changed the title Reduced ToggleSwitch's height to 24px Reduced ToggleSwitch's height to 16px and 24px for both sizes Dec 10, 2024
@smmr-dn smmr-dn changed the title Reduced ToggleSwitch's height to 16px and 24px for both sizes Reduced ToggleSwitch's heights to 16px and 24px Dec 10, 2024
@mayank99
Copy link
Contributor

mayank99 commented Dec 10, 2024

I just double checked and realized that there are two sizes for ToggleSwitch: small 18px and medium (default) 26px, which have now been reduced to 16px and 24px. Were these supposed to be 16px and 24px instead of 18px and 26px?

Oh wow, I'm not sure how I missed this. I thought they were the same height as our other components (i.e. 24px and 36px).

Looking at our Figma library, the heights appear to be 18px and 24px, so let's go with that for now. More specifically, the dimensions are 46x24 and 32x18.

I personally think 24px is too short for the default toggle switch, but we can have that conversation in the future (outside this PR).

@mayank99 mayank99 dismissed their stale review December 10, 2024 18:14

Misunderstanding.

Copy link
Member

@r100-stack r100-stack left a comment

Choose a reason for hiding this comment

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

Just left a small comment. Regarding the actual sizes, agreed with @mayank99's comments.

'@itwin/itwinui-css': patch
---

`iui-toggle-switch` now has the height of 24px.
Copy link
Member

Choose a reason for hiding this comment

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

You might need to mention which size is now 24px, because there are multiple ToggleSwitch sizes.

Same for the other changeset.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have updated the changesets.

@smmr-dn smmr-dn changed the title Reduced ToggleSwitch's heights to 16px and 24px Reduced default ToggleSwitch's height to 24px Dec 12, 2024
@smmr-dn
Copy link
Contributor Author

smmr-dn commented Dec 13, 2024

The 26px in height for default ToggleSwitch was intended in the code. The parent's border adds up to the content inside (46x24) which results in the 48x26 intended size. Closing this PR since the fix is no longer needed.

@smmr-dn smmr-dn closed this Dec 13, 2024
@smmr-dn smmr-dn deleted the uyen/toggle-height branch December 13, 2024 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants