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

Fix alignment of heading icon #4736

Merged

Conversation

bartaz
Copy link
Member

@bartaz bartaz commented Apr 17, 2023

Done

Fixes heading icon alignment

Fixes WD-3211

QA

  • Open demo
  • Make sure icons in heading icon are aligned as expected

Screenshots

image

@webteam-app
Copy link

Demo starting at https://vanilla-framework-4736.demos.haus

@ClementChaumel
Copy link
Contributor

The alignment is off on smaller screen sizes

small:
image
default:
image

@@ -22,25 +22,26 @@
height: map-get($icon-sizes, heading-icon--small);
margin-bottom: 0;
margin-right: $sph--large;
margin-top: map-get($nudges, h3-mobile);
margin-top: calc(map-get($nudges, h3-mobile) / 2); // just a quick fix, should be calculated based on line height and icon size
Copy link
Contributor

Choose a reason for hiding this comment

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

What is missing to do this calculation?

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess ideally instead of arbitrary pushing it, we should attempt to center the icon within line height of the heading, so the calculation would need to calculate the difference between icon size and line height and use half of that to position the icon.

Maybe I'll just do it if that helps with the mobile positioning.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does it center the icon, if you set the line-height of the icon to the same as the heading?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, the icon is not "within" a line height, it's an image in flex box, that has to be aligned relative to heading that follows it. And I don't think we should refactor the component now, we just need to adjust it to new heading sizes.

This component (heading icon) was causing problems before, both from design and development point of view, so we should probably have a look at deprecating or re-doing it with the component rebranding.

@bartaz
Copy link
Member Author

bartaz commented Apr 19, 2023

  • We need to find examples on ubuntu.com where this component is used and verify how it will be affected.
  • We should make sure the heading with icon used h4 styling.

@bartaz bartaz force-pushed the typography-changes-heading-icon branch from 4b9f15e to f313693 Compare April 19, 2023 10:23
@bartaz
Copy link
Member Author

bartaz commented Apr 19, 2023

I proactively fixed some of the issues with heading icons in ubuntu.com to hopefully make the update easier: canonical/ubuntu.com#12807

Copy link
Contributor

@ClementChaumel ClementChaumel left a comment

Choose a reason for hiding this comment

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

Looking good!

scss/_patterns_heading-icon.scss Outdated Show resolved Hide resolved
Co-authored-by: ClementChaumel <clement.chaumel@gmail.com>
@bartaz bartaz merged commit 24acaec into canonical:typography-changes Apr 21, 2023
@bartaz bartaz deleted the typography-changes-heading-icon branch April 21, 2023 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants