style(components): fix styles when only a single component is imported#14015
Conversation
✅ Deploy Preview for carbon-components-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for carbon-elements ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
133364f to
9991e8d
Compare
francinelucca
left a comment
There was a problem hiding this comment.
Tested the following components:
- Copy Button ✅
- Button ✅
- Datepicker ✅
- Dropdown ✅
- Loading ✅
- MenuButton ✅
- Search ✅
- Select ✅
- Tabs ✅
- Breadcrumb
I see a mismatch on the padding of theol:
- Popover
I see some extra spacing:
- TimePicker
Invalid icon color is off:
Also noticed the difference in font, I do feel those should carry over, or is that supposed to be set somewhere at the lop level of the application? 🤔
5c408aa to
3adadc5
Compare
|
@francine pushed up some fixes, namely adding the |
3adadc5 to
fc3237c
Compare
tay1orjones
left a comment
There was a problem hiding this comment.
Looks good to me, I couldn't find any defects perusing the storybook for a while. Snapshots do need updated though, looks like the changes from adding the font-family and such are the root of the snapshot changes.
df87da9 to
e1b7dc9
Compare
francinelucca
left a comment
There was a problem hiding this comment.
Tested the following:
- Accordion ✅
- Breadcrumb ✅
- Multiselect ✅
- Popover ✅
- Slider ✅
- StructuredList ✅
- ContentSwitcher ✅
- Treeview ✅
- Modal
I see a difference in spacing:
- TimePicker
Warn icon is read instead of yellow
Overall:
I see a difference in the text color:
Screen.Recording.2023-06-22.at.2.02.21.PM.mov
|
@francinelucca The text change is coming from the |
|
@francinelucca I've fixed the other issues. It seems like adding it to @use '@carbon/styles/scss/type';
@use '@carbon/styles/scss/components/accordion';
@include type.reset();and this would pull in all of the font families as well and would reduce a lot of the changes here. What do you think? |
72abd60 to
6fa5668
Compare
|
Reverted all type package changes, if a user is expecting to use Carbon type/fonts they would need to also pull in |
@tw15egan That's probably going to be the default expectation by and large from everyone, right? I think we need to heavily document this in the repo (@carbon/react readme, @carbon/styles readme, v11.md changelog, etc) and the website. Is this isolated to only use-cases where component styles are brought in individually? Consumers won't need to do this if they just |
|
@tay1orjones correct, if you pull in |
|
@tw15egan That makes sense 👍 If they |
|
I hadn't thought about that, I would assume the |
francinelucca
left a comment
There was a problem hiding this comment.
Confirmed previously reported issues have been fixed
Confirmed can correctly pull in types using @use '@carbon/styles/scss/type' as type; and @include type.reset();
Approving pending Taylor's docs comments
Closes #14008
This ensures all component styles have the necessary imports to render correctly if only that single component is imported.
Changelog
Changed
layer)component-reset.resetwas being applied properly so there were no padding issues when the global reset was not present@usedeclarationsTesting / Reviewing
Question: Should font declarations be included in each component import? Right now it does not set
IBM Plex Sansanywhere. If so, we just need to add@include font-family('sans');right after thecomponent-resetfor each componentTest out a bunch of components by pulling this down locally, going to
packages/react/.storybook/styles.scssand commenting everything out. Then, test individual components like so@use '@carbon/styles/scss/components/button';and ensure it renders as expected. Also, there should be no visual differences when importing all styles