-
Notifications
You must be signed in to change notification settings - Fork 4k
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
docs(Responsive): deprecate component #4008
Conversation
size-limit report
|
Codecov Report
@@ Coverage Diff @@
## master #4008 +/- ##
=======================================
Coverage 99.84% 99.84%
=======================================
Files 185 185
Lines 3245 3251 +6
=======================================
+ Hits 3240 3246 +6
Misses 5 5
Continue to review full report at Codecov.
|
I'm not sure its important: The code in after is incorrect: It still use I think also the docs should have a gentle reminder that it might not be the best solution to put the entire page under conditional render like the home page example does because it might end up duplicating data when using SSR. |
b1b675a
to
d2cac3d
Compare
@sveinse I update PR description (final version) & add a comment to |
@layershifter looks good ✔️. I've tested the after example successfully and I've glanced at the PR commit. Looks good from my humble eyes. |
@sveinse thanks for your input 👍 Also leaving a link to your comment (#4002 (comment)) there. |
This might be obvious to other people, but I struggled with using the above examples with the To fix this I used the render-props option they document here: https://github.com/artsy/fresnel#media. Even then it's not perfect as my responsive buttons don't neatly sit in button groups any more (as the :first and :last css selectors don't consider elements that are present but hidden), but it does at least work |
…g/Semantic-UI-React#4008) + Site base structure upgrade
@charliematters There is no obvious things, thanks for rising this 👍 If you are not using SSR/SSG<Button.Group>
<Media at="mobile">
{(mediaClassNames, renderChildren) => {
return renderChildren ? <Button>Hello mobile!</Button> : null;
}}
</Media>
<Button>Always</Button>
<Media greaterThan="mobile">
{(mediaClassNames, renderChildren) => {
return renderChildren ? <Button>Hello desktop!</Button> : null;
}}
</Media>
</Button.Group> <div class="ui buttons">
<button class="ui button">Hello mobile!</button
><button class="ui button">Always</button>
</div> This code will do exactly the same thing as If you're using SSR/SSGIf you're using Next.js/Gatsby/other tool and will try to use the code above you will get this warning:
And this is correct, styling that is built with <NoSSR>
<Button.Group>
<Media at="mobile">
{(mediaClassNames, renderChildren) => {
return renderChildren ? <Button>Hello mobile!</Button> : null;
}}
</Media>
<Button>Always</Button>
<Media greaterThan="mobile">
{(mediaClassNames, renderChildren) => {
return renderChildren ? <Button>Hello desktop!</Button> : null;
}}
</Media>
</Button.Group>
</NoSSR> https://codesandbox.io/s/semantic-ui-react-and-artsyfresnel-forked-uluj1?file=/pages/index.js |
Hi @layershifter ,
Could you guide me on how can I implement it? |
@gb9box It's not related to this change actually... You can use |
This PR marks
Responsive
as deprecated, we will remove it in the next major release, i.e.2.0.0
.Fixes #4002.
❓ Why?
We did with this component two design mistakes 🚒
💅 Not CSS origin
This component does not have connection between Semantic UI CSS and our implementation. This causes mismatch our defined breakpoints (https://semantic-ui.com/elements/container.html) in CSS and JS part.
⚙️ SSR support
With previous item it's possible to survive, but this item is really annoying as SSR and SSG are popular and provide great experience (Next.js, Gatsby). Numerous issues without simple solution is a sign of this failure (#3110, #3398, #3948, #4002).
➡️ How to migrate?
In our example (HomepageLayout) I made a switch to @artsy/fresnel. These changes are part of this PR.
This package was chosen as a suggested replacement as it works great with Next.js & Gatsby (https://github.com/artsy/fresnel#usage-with-gatsby-or-next) and it does not use conditional rendering (https://github.com/artsy/fresnel#why-not-conditionally-render).
Before
After
Examples
Preconfigured examples on CodeSandbox:
All of them can be deployed to Vercel for verification.