-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Icon list modifications #3991
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
Icon list modifications #3991
Conversation
- Add responsive size variants - Apply custom size to entire container
- Use adaptive size for usa-icon-list__title elements, but not others - Move default title styling to end - Use system heading line height for title elements
- Use rem for icon size for more reliable accessible resize - Use rem values for padding - Use them-body-font-size for the default - Sync heading size between default and variant versions
- Reduce left padding - Simplify sass structure, put less in the override prose mixin
| $quoted-bp: smart-quote($bp); | ||
| $our-breakpoints: map-deep-get($system-properties, breakpoints, standard); | ||
| @if map-has-key($our-breakpoints, $quoted-bp) { | ||
| @if $quoted-bp == "none" { |
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.
Added this to facilitate better looping in my responsive breakpoints loop
| > *:last-child { | ||
| margin-bottom: 0; |
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.
Don't let last-child's margin affect li/li spacing
mitchmoccia
left a comment
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.
Everything looks great @thisisdano I'm going to merge this and update the guidance site now, thank you
Preview →
This PR makes a few modifications to (hopefully!) streamline and improve the functionality of the icon list.
First, I'd like to focus the icon list a use case that's closer in spirit to a conventional unordered list, except using an icon instead of a bullet. This means building for shorter lists, with only a few words or sentences per list item, or a slightly more robust list item, with a title and some accompanying text:
Default list
List with rich text
Next, I wanted to simplify the implementation for lists that use a custom size. I liked how you could pass a size variant into the list and it would update the icon and the text — but I didn't like the extra step of adding the
usa-icon-list--titleclass. This PR changes the behavior, so that content inside ofusa-icon-list--contentgets the custom sizing. For example:Default
Large variant
This custom sizing only applies to text directly inside the
usa-icon-list__contentelement. Any block-level child ofusa-icon-list__contentgetsinitialstyling. So, if you want to have custom styled text inside content, just put it in ap,h3,div, or whatever. You can add theusa-icon-list__titleclass to a block-level heading that should get the custom sizing:Styling controlled with
span,em,strong, etc works as expected:Other changes
Responsive variants
Added responsive prefixing to the size variant. Larger sizes would be impractical for narrow widths, but devs should be able to access them when they're appropriate. So now you can add something like
tablet:usa-icon-list--size-lg.responsive-icon-list.mp4
Rem sizing
I rebuilt some of the sizing and spacing Sass to use rem instead of px. This will help with responsiveness and accessibility, especially if users have custom font sizing set in their browser.
Size and spacing adjustments
I reduced the size and padding of the icons a bit, and reduced the size of the default title to the same as the text size, except bold.