ZopaPublic / react-components

Shared React components for the Zopa projects.
https://zrc.netlify.app
MIT License
41 stars 14 forks source link

Atomic show & hide classes #533

Open moshie opened 4 years ago

moshie commented 4 years ago

What do you think to having classes such as l:hide & xs:show for showing and hiding elements at different breakpoints?

const createDisplayStyles = () =>
  Object.keys(grid.breakpoints).reduce(
    (mediaQueries, breakpoint) => ({
      ...mediaQueries,
      [`@media screen and (min-width: ${grid.breakpoints[breakpoint]}px)`]: {
        [`body .${breakpoint}\\:show`]: {
          display: 'block',
        },
        [`.${breakpoint}\\:hide`]: {
          display: 'none',
        },
      },
    }),
    {}
  )
tlaak commented 4 years ago

I would have needed these today so take that as a yes.

tlaak commented 4 years ago

Display value could in some cases be flex or something else than block though

moshie commented 4 years ago

The concerns are the mixing of two very different css methodologies.

Perhaps we may consider adding atomic classes to our roadmap however, that is a discussion for the guild.

i.e. <Button fullWidth={true} /> vs <Button className="w-100" /> <Text align="center" /> vs <Text className="text-center" />