Skip to content
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

Inlined media match #11

Open
4 tasks
theKashey opened this issue Mar 17, 2019 · 0 comments
Open
4 tasks

Inlined media match #11

theKashey opened this issue Mar 17, 2019 · 0 comments

Comments

@theKashey
Copy link
Collaborator

theKashey commented Mar 17, 2019

The current solution is great, but not great-great for server side - while reactive approach is good for SPA, adaptive might be a better choice for SSR.

Actually - this is not a good idea to ship two different code variants, but - sometimes there is no choice

Idea:

  • add a flag to Matcher, to wrap every media result with media guard, which would display such result in case of media match
  • add a flag to Matcher, to return more than than(up to all) result. That would lead to adaptive layout.
  • add a flag to Matcher, for else condition, displaying provided failback if the main condition is not met.
  • (bonus) measure branches size, and warn if too many data got rendered.
<Matcher
 adaptive
 mobile="mobile"
 tablet="tablet"
>
// probably some user-provided className should be set to the adaptive div.
<div class='media-adaptive-mobile'>mobile</div>
<div class='media-adaptive-tablet'>tablet</div>
<Matcher
 failback={<div className="failback-div"/>}
 mobile="mobile"
 tablet="tablet"
>
// 
<div class='media-adaptive-mobile'>mobile</div>
<div class='media-adaptive-not-mobile'><div className="failback-div"/></div>

Then - failback-div could use standard responsive things do adapt placeholder for a right media, untill hydration.

That would make media matcher SSR friendly for the cases of client-side javascript disabled, or just lower TTI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant