-
-
Notifications
You must be signed in to change notification settings - Fork 175
_media doesn't evaluate dynamically #799
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
Comments
In order to update block definitions, operators must also be reevaluated in engine. This can be done by calling |
I agree, but I don't think that should be part of the |
True also there is an events class for every block, so not what we are looking for. Maybe this should be implemented from |
Maybe another solution for responsive layouts would be to have additional, size-dependent layout subkeys? layout:
span: 24
md:
span:
12
lg:
span:
8 The above example would simply add the layout classes with some kind of CSS media query, similar to how TailwindCSS does it. What do you think? |
This is already a feature that we forgot to document properly 😅. You can see #685 for reference. At least this means the schema we have is intuitive |
Haha alright that makes my life easier instantly, thank you 😄 |
Btw, all styles are implemented as emotion classes. So you can use media queries like so:
However, we also implement standard breakpoints as a shorthand for styles:
See mediaToCssObject for implementation. |
Sorry, updated / corrected the previous comment. |
The
_media
operator returns information about the current screen dimensions, but doesn't update them if the size changes during client runtime.Ideally, the data would change if the window is resized, so block visibility could be controlled by media queries, similar to CSS.
There's mainly two ways this can be achieved in modern browsers:
resize
event:Listening to the event (ideally debounced), we can set the current screen dimensions after the window has been resized.
matchMedia()
function:Using
matchMedia
, we can attach CSS media queries to thewindow
object and add event listeners that will be triggered if the query starts to match, or doesn't match any longer. This allows to set named breakpoints (eg.sm
,lg
, etc.) in the application state.By implementing those features combined, we could have up-to-date media query information available.
The text was updated successfully, but these errors were encountered: