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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stepped counter size #4584

Merged
merged 4 commits into from
Oct 20, 2022
Merged

Conversation

huwshimi
Copy link
Contributor

@huwshimi huwshimi commented Oct 13, 2022

Done

  • Update stepped lists to use a fixed font size for the counters.

Fixes #4561.

QA

Check if PR is ready for release

If this PR contains Vanilla SCSS code changes, it should contain the following changes to make sure it's ready for the release:

  • PR should have one of the following labels to automatically categorise it in release notes:
    • Feature 馃巵, Breaking Change 馃挘, Bug 馃悰, Documentation 馃摑, Maintenance 馃敤.
  • Vanilla version in package.json should be updated relative to the most recent release, following semver convention:
    • if CSS class names are not changed it can be bugfix relesase (x.x.X)
    • if CSS class names are changed/added/removed it should be minor version (x.X.0)
    • see the wiki for more details
  • Any changes to component class names (new patterns, variants, removed or added features) should be listed on the what's new page.
  • Documentation side navigation should be updated with the relevant labels.

Screenshots

Screen Shot 2022-10-13 at 2 18 58 pm

@huwshimi huwshimi added the Feature 馃巵 New feature or request label Oct 13, 2022
@webteam-app
Copy link

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

@lyubomir-popov
Copy link
Contributor

lyubomir-popov commented Oct 13, 2022

@huwshimi I would do this:

line-height: calc(1.5rem - 2px);
width: 1.5rem;
margin-top: 0.5rem;

also weight: 300, sorry for the confusion I know I said 400 previously.
(margin-top .25rem) on the h4 - the correct calculation is .5 * ([ heading line-height] - [counter height]) I think.

And we also need to bring text closer as the padding on it is taking the icon width into account

(Please use variables to express the above things, I've just done it quick and dirty here)

End result:

image

@huwshimi
Copy link
Contributor Author

Thanks @lyubomir-popov I've updated it so it now looks like this:

dev local_8101_docs_examples_patterns_lists_lists-stepped

Copy link
Contributor

@lyubomir-popov lyubomir-popov left a comment

Choose a reason for hiding this comment

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

you need the mobile nudges in one of the calculations, suggestion in the code.

// the height difference between the bullet and the title and then add the
// nudge to position it with the lower case text.
$bullet-margin: ((map-get($line-heights, h#{$i}) - $bullet-width) / 2) + map-get($nudges, h#{$i});
$bullet-margin-mobile: ((map-get($line-heights, h#{$i}-mobile) - $bullet-width-mobile) / 2) + map-get($nudges, h#{$i});
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$bullet-margin-mobile: ((map-get($line-heights, h#{$i}-mobile) - $bullet-width-mobile) / 2) + map-get($nudges, h#{$i});
$bullet-margin-mobile: ((map-get($line-heights, h#{$i}-mobile) - $bullet-width-mobile) / 2) + map-get($nudges, h#{$i}-mobile);

Copy link
Contributor

Choose a reason for hiding this comment

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

also, if you do the above you need to add h5 as an entry in the map and copy the value from h4. Otherwise you'd need to make an exception in the for loop logic.

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 initially tried with the mobile nudges but for some reason the counters get moved quite significantly out of alignment:

dev local_8101_docs_examples_patterns_lists_lists-stepped

Whereas using the non-mobile nudges they maintain their position for both mobile/non-mobile. I wonder if that's because the counter is inside the heading element which already applies the nudge to the padding. It looks like the counter would be in the right place if it was a sibling of the heading element.

Copy link
Contributor

@bartaz bartaz left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@bartaz bartaz merged commit 978d5e0 into canonical:main Oct 20, 2022
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.

Stepped lists: Change counter font-size to root font size
4 participants