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(Icon): Add invisble text content to simplify baseline alignment #1905

Merged
merged 5 commits into from
Mar 7, 2025

Conversation

VincentSmedinga
Copy link
Contributor

Describe the pull request

Thank you for contributing to the project!
Please use this template to help us handle your PR smoothly.

What

This lets the browser use baseline alignment to align an icon with text. We make the icon adhere to that feature by adding a zero-width space to its ::after pseudo-element.

Why

It seems more idiomatic to use the browser’s baseline alignment feature to align an icon to accompanying text. We still need to apply typography to the icon, but that’s logical: we treat an icon as a typographic element. Stretching the icon and the pseudo-element and using a width of 1em are more examples of using what CSS offers us. We don’t need to multiply font size with line height anymore, and we don’t need to manually size the SVG while we were already sizing its container.

How

See above.

Checklist

Before submitting your pull request, please ensure you have done the following. Check each checkmark if you have done so or if it wasn't necessary:

  • Add or update unit tests
  • Add or update documentation
  • Add or update stories
  • Add or update exports in index.* files
  • Start the PR title with a Conventional Commit prefix, as explained here.

Additional notes

  • n/a

@VincentSmedinga VincentSmedinga requested a review from dlnr March 4, 2025 22:33
@VincentSmedinga VincentSmedinga requested a review from a team as a code owner March 4, 2025 22:33
@github-actions github-actions bot temporarily deployed to demo-DES-1183-icon-alignment March 4, 2025 22:36 Destroyed
@alimpens
Copy link
Contributor

alimpens commented Mar 5, 2025

Nice, this approach is way cleaner!

@github-actions github-actions bot temporarily deployed to demo-DES-1183-icon-alignment March 5, 2025 23:12 Destroyed
Co-authored-by: Aram <37216945+alimpens@users.noreply.github.com>
@github-actions github-actions bot temporarily deployed to demo-DES-1183-icon-alignment March 6, 2025 17:06 Destroyed
@VincentSmedinga VincentSmedinga requested a review from alimpens March 6, 2025 17:06
@github-actions github-actions bot temporarily deployed to demo-DES-1183-icon-alignment March 6, 2025 17:09 Destroyed
@alimpens alimpens merged commit 190b588 into develop Mar 7, 2025
6 checks passed
@alimpens alimpens deleted the feat/DES-1183-icon-alignment branch March 7, 2025 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants