-
Notifications
You must be signed in to change notification settings - Fork 565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adapts Blankslate to render proportionally in narrow areas #3869
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
28048e9
adapts Blankslate to render proportionally in narrow areas
mperrotti 2c46e8d
Merge branch 'main' of github.com:primer/react into mp/responsive-bla…
mperrotti 088744f
adds color token fallbacks
mperrotti 33ae86c
adds changeset
mperrotti d306147
Merge branch 'main' into mp/responsive-blankslate
mperrotti b9ad3dc
formats CSS with Prettier
mperrotti c2c7d76
rm dead css module style
mperrotti df91680
uses smarter primitives
mperrotti 78c840d
tweaks type scale
mperrotti 36ba437
improves token usage
mperrotti 77ab644
Merge branch 'main' into mp/responsive-blankslate
mperrotti 0acd61f
Merge branch 'mp/responsive-blankslate' of github.com:primer/react in…
mperrotti b7dfad8
upgrades styled-components, converts Blankslate styles back to styled…
mperrotti a42a511
Merge branch 'main' into mp/responsive-blankslate
mperrotti d0b9ddd
adds comment explaining why 34rem for min-width
mperrotti b1577a3
Merge branch 'main' into mp/responsive-blankslate
mperrotti acb0751
Merge branch 'main' into mp/responsive-blankslate
mperrotti 6ec504d
renders an inline style block to get around styled-component 5.x limi…
mperrotti d1da577
Merge branch 'main' into mp/responsive-blankslate
mperrotti e293e76
Merge branch 'main' into mp/responsive-blankslate
mperrotti e649e1b
Merge branch 'main' into mp/responsive-blankslate
mperrotti df28cf9
Merge branch 'main' into mp/responsive-blankslate
mperrotti 6ceffe7
Merge branch 'main' into mp/responsive-blankslate
mperrotti e1f34cb
Update src/Blankslate/Blankslate.tsx
mperrotti 6a218c2
Merge branch 'main' into mp/responsive-blankslate
mperrotti 8e2275e
Merge branch 'main' into mp/responsive-blankslate
mperrotti 4c8046d
Merge branch 'main' into mp/responsive-blankslate
mperrotti d2367ab
Merge branch 'main' into mp/responsive-blankslate
mperrotti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@primer/react': patch | ||
--- | ||
|
||
Adapts Blankslate to render proportionally in narrow areas. | ||
|
||
<!-- Changed components: Blankslate --> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good news: This is the first component in primer/react (outside of drafts) that uses css modules. ✨
To get the css into dotcom, we need to import a single css file for primer/react (similar to primer/css)
Bad news:
This is a breaking change because now we require you to include a css file for an existing component that we didn't earlier? Without that stylesheet, existing BlankSlate instances would become unstyled.
(New components get a free pass because it's a new component with a new import statement, but tricker to change existing components like this)
Probably still fine to squeeze into dotcom, but not for open source?
The ideal order for us would be to add the one primer/react css file requirement in v36. Once that's done, we can keep adding more css bundled to that file, no worries
@joshblack @langermank Is there a workaround for this that comes to mind? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think there's any way we can use BaseStyles to import CSS modules?
If this has to be a breaking change, should we hold off on this until the next major release?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't use BaseStyles to import CSS modules, buuuut we could use it as a temporary place to add global css for components! 😈
For the css files, yes. But we could break this into 2 parts:
To release the 2nd PR (breaking), our options are:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't going to be possible since
styled-components
doesn't recognize@container
, and it will get stripped out.I think doing a quick v37 release right after v36 is the best path forward. I don't think there's any way to handle these updates without introducing a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I know, styled-components doesn't validate syntax though and strip it out. Here's an example of container queries with styled-components: https://codesandbox.io/s/zen-hill-v939m3?file=/src/App.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siddharthkp - so your official suggestion is to add
<style type="text/css">{ContainerQuery}</style>
inline?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To unblock this PR: It sounds icky but Yes 😅 (hoping that dotcom doesn't have any problems with that)
Follow up would be to start collecting candidates for v37 where we can make a css file import required.
Of course, we also have the option of pausing this PR and releasing with it the next major release. But, I'm honestly don't know what the timeline for that would look like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if I missed this in the thread earlier, but would another option here be to use
createGlobalStyle
? e.g.Was curious if this ended up working as expected. I think this has an advantage of having a shared stylesheet instead of having a
<style>
tag per instance of Blankslate (if it works, that is 😅)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joshblack - I think using
createGlobalStyle
would still results in@container (max-width:600px)
getting written without an open curly brace. Check out @siddharthkp 's comment above for more context.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, makes sense! Thanks @mperrotti for clarifying