react icon indicating copy to clipboard operation
react copied to clipboard

Prototyping responsiveness with Primer React is impossible due to the lack of docs and/or presets

Open maximedegreve opened this issue 8 months ago • 5 comments

Description

All the docs below talk about the sx prop however internally we have communicated to avoid this:

  • https://primer.style/product/getting-started/react/
  • https://primer.style/product/getting-started/react/core-concepts/
  • https://primer.style/product/getting-started/react/theming/

This leaves us with CSS modules but those don't support breakpoint vars out the box. On dotcom and storybook we have solved this by introducing a postcss-preset however this is not documented and exported and therefore can't be used. This makes the adoption of responsiveness in Primer prototypes almost impossible as it requires a lot of reading and fiddling to mimic this functionality:

  • https://github.com/primer/react/blob/main/packages/postcss-preset-primer/src/index.js

Steps to reproduce

  1. Create a React app (with Vite)
  2. Follow the instructions in the getting started docs
  3. Try to make anything responsiveness using @media vars.

Perhaps we could do some user testing too to see how easy it is for someone internally to adopt Primer outside dotcom.

Version

All

Browser

No response

maximedegreve avatar May 04 '25 19:05 maximedegreve

Related: https://github.com/primer/react-template/pull/228 (note: media queries aren't working)

lesliecdubs avatar May 05 '25 16:05 lesliecdubs

I think @jonrohan and @langermank were looking to update some of this content over in: https://github.com/github/primer-docs/pull/452, not sure if they are tackling responsiveness directly but it would be covering the shift to CSS Modules if I understand right.

joshblack avatar May 05 '25 16:05 joshblack

like a more formal version

vibishraj001 avatar May 09 '25 08:05 vibishraj001

hey @joshblack @jonrohan @langermank ! how is this looking at the moment?

hellojanehere avatar Aug 22 '25 13:08 hellojanehere

I haven't done anything here more than what we had in that linked PR https://github.com/github/primer-docs/pull/452

jonrohan avatar Sep 04 '25 17:09 jonrohan