Skip to content

First CSS property in list must specify all slots #9

Description

@staylor

If I do not specify 4 values for the first property, rules will get output out of order, which causes precedence issues:

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-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:

background: [themeUtils.color.white, themeUtils.color.white, 'transparent', 'transparent']

This library is awesome, thank you for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions