-
Notifications
You must be signed in to change notification settings - Fork 327
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
Adjust tag component padding to compensate for font spacing #955
Conversation
5a7dbfb
to
edd5d39
Compare
edd5d39
to
7d3b816
Compare
7d3b816
to
e07a915
Compare
src/components/tag/_tag.scss
Outdated
// Since New Transport sits slightly higher than other common fonts. | ||
// We use intentionally uneven padding to make it balanced, this can be | ||
// removed using the version of the font that has a more common vertical spacing. | ||
@if $govuk-font-family == $govuk-font-family-nta { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this isn't true, then the alpha tag ends up with 4px on top and bottom, which makes it 28px – considerably larger than the 'with nta' variant and no longer following our /5 rhythm. I think if we're going to try and make this 'conditional' we should make sure that the component still follows our rules in both cases.
In other places we're just commenting and applying adjustments by taking from one side and adding to the other, e.g. like this: https://github.com/alphagov/govuk-frontend/blob/master/src/components/button/_button.scss#L164-L178
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thought process:
- As far as I know the 5 pixels is a scale based on how NTA works (might be wrong)
- The component being a little bit bigger is much better than it looking completely broken as seen in the screenshots.
I'll make this less clever and we'll figure this out when we do proper theming support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 5px thing is not related to the font, it's a decision based on the font-size / line-height combination. Each font size has a line-height rounded to the nearest 5px increment. This is why the spacing scale is increments of 5px and 10px and the inputs, buttons etc have been standardised at 40px (45px with the start button)
I say this, but this has mainly been considered for the main content of the page, there were way too many variables to make it work properly for the header and beforeContent area...haven't checked it in a while.
e07a915
to
9f299fd
Compare
Until we update GOV.UK Frontend with the new font, NTA sits higher than common fonts, so we need to add adjustments to compensate.
9f299fd
to
aba9492
Compare
This is in response to an issue raised on the backlog.
Until we update GOV.UK Frontend with the new font, NTA
sits higher than common fonts, so we need to add adjustments
to compensate.
Links for review:
Screenshots
Before changes
Tag using default font with no changes
After changes
Tag using default font with changes
https://trello.com/c/GV0PxHFL/1319-fix-vertical-text-alignment-in-tag-component