rebassjs / grid

This package has moved and renamed
https://rebassjs.org/reflexbox
MIT License
2.04k stars 96 forks source link

Themes that use objects for responsive values aren't working as expected #177

Closed hamlim closed 5 years ago

hamlim commented 5 years ago

It seems like rebass/grid Box and Flex components don't correctly work with responsive-defined props and theme values.

I created a sandbox to showcase the issue here: https://codesandbox.io/s/n3po0v67o4

This sandbox compares:

between:

and a local styled-system version of the Flex component using Emotion.

The sandbox showcases that the array-defined themes work as expected, but the object-defined themes do not except for the styled-system variation.

Simpler example:

const themeA = {
  breakpoints: { small: 0, medium:  '500px', large: '1000px' }
}

const themeB = {
  breakpoints: [ 0, '500px', '1000px' ]
}

// Doesn't work as expected
<Box m={{ small: '10px', medium: '15px', large: '20px' }} theme={themeA}>Test</Box>

// Works as expected
<Box m={[ '10px', '15px', '20px' ]} theme={themeB}>Test</Box>

Looking at the source code for Box and Flex within this project, I am not sure I understand why this would be the case.

jxnblk commented 5 years ago

Sorry for the delay! This package has moved to https://github.com/rebassjs/rebass/tree/master/packages/reflexbox and it uses the latest version of Styled System. If you're still encountering this issue with the new package, please open an issue on that repo