emotion-js / emotion-js/facepaint
First CSS property in list must specify all slots
- Dominant language
- JavaScript
- Stars
- 594
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
If I do not specify 4 values for the first property, rules will get output out of order, which causes precedence issues:
```js
const mqSection = facepaint([
themeUtils.breakpoint.medium,
themeUtils.breakpoint.mediumLarge,
'@media print',
]);
const responsiveSection = mqSection({
// first prop has to have same length as facepaint list
background: [themeUtils.color.white, themeUtils.color.white, 'transparent'],
borderBottom: [`1px solid ${themeUtils.color.gray60}`, null, 0],
height: ['36px', '35px'],
padding: ['8px 15px 3px', '11px 15px 6px', '4px 15px 2px'],
});
```
See:
```css
.css-1evbtg0 {
background: #fff;
border-bottom: 1px solid #e2e2e2;
height: 36px;
padding: 8px 15px 3px;
position: relative;
}
@media (min-width:1024px) {
.css-1evbtg0 {
background: transparent;
border-bottom: 0;
height: 35px;
padding: 4px 15px 2px;
}
}
@media print{
.css-1evbtg0 {
border-bottom: 0;
height: 35px;
padding: 4px 15px 2px;
}
}
/* correct values, but is now overwriting 1024px */
@media (min-width:720px) {
.css-1evbtg0 {
height: 35px;
padding: 11px 15px 6px;
}
}
```
when I specify this it works fine:
```js
background: [themeUtils.color.white, themeUtils.color.white, 'transparent', 'transparent']
```
This library is awesome, thank you for it.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.