USWDS - Icon list: Allow $theme-body-font-size to accept all size tokens#5363
USWDS - Icon list: Allow $theme-body-font-size to accept all size tokens#5363thisisdano merged 3 commits intodevelopfrom
Conversation
mahoneycm
left a comment
There was a problem hiding this comment.
Intuitive and effective!
- Updating
$theme-body-font-sizewith2xsand3xscorrectly updated icon list - No compilation errors with listed values
- Compilation errors correctly when using an unaccepted value
- No noted visual regression
mejiaj
left a comment
There was a problem hiding this comment.
Nice fix, all type scale settings are now supported!
Warning
Added note about increased size in compiled CSS file at the end.
Items tested
- No compile errors
- Icon list generates sizes based on all size tokens 1
Alternate testing
You can visit the variant Icon List Custom Size and change icon size via StorybookJS controls.
Storybook adds a textarea you can use to test the generated values.
Values tested
uswds/packages/uswds-core/src/styles/tokens/font/type-scale.scss
Lines 1 to 23 in 0395273
uswds/packages/uswds-core/src/styles/variables/type-scale.scss
Lines 1 to 18 in d5a7fb0
Footnotes
-
⚠️ Warning: Compiled CSS file size increases.620KB on developvs659KB on al-icon-list-scale↩
thisisdano
left a comment
There was a problem hiding this comment.
Good callout on the compiled CSS size increase, though I think this fix is good to go as-is and the impact on minified CSS should be minimal

Summary
Updated icon list styles to allow
$theme-body-font-sizeto accept2xsand3xssize tokens.Breaking change
This is not a breaking change.
Related issue
Issue #5357
Related PR
Changelog and documentation update PR
Preview link
Preview link: Icon list component
Problem statement
Icon list styles are preventing users from setting
$theme-body-font-sizeto2xsor3xssize tokens.Solution
Currently, the icon list styles rely on a component-specific map ($theme-body-font-sizes) to translate acceptable token values. This map does not include
2xsor3xssizes.Because icon list styles rely on $theme-body-font-size as a fallback when it can't find a value in
$theme-body-font-sizes, it doesn't know what to do when$theme-body-font-sizeis set to2xsor3xs. It cannot translate the value.To allow these missing size tokens, as well as remove the need for maintaining a component-specific map, this PR uses the system
$all-type-scalein place of$theme-body-font-sizes. The $all-type-scale variable inuswds-corecombines $project-type-scale and $system-type-scale maps.Considerations
2xsand3xsfrom the icon list sizes. If so, we should build an alternate solution.Testing and review
$theme-body-font-size, including "2xs" and "3xs"