react-components icon indicating copy to clipboard operation
react-components copied to clipboard

Atomic show & hide classes

Open moshie opened this issue 5 years ago • 3 comments

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',
        },
      },
    }),
    {}
  )

moshie avatar Jun 30 '20 09:06 moshie

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

tlaak avatar Jun 30 '20 09:06 tlaak

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

tlaak avatar Jun 30 '20 09:06 tlaak

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" />

moshie avatar Jun 30 '20 10:06 moshie