Replies: 5 comments 6 replies
-
I like this but it'll require a little more work on our side than the solution I mentioned internally I think depending on how far we want to go with the query syntax in the size attribute.
|
Beta Was this translation helpful? Give feedback.
-
actually this is good. I'm gonna add new state properties was thinking this could be a powerful concept where we add some other predetermined state properties as well like |
Beta Was this translation helpful? Give feedback.
-
It might be nice to be similar to the |
Beta Was this translation helpful? Give feedback.
-
I did some more thinking on this one and I think we should try not to mix the 2 syntaxes because it will cause confusion while editing the template I'm still open to the idea but keep in mind it will require another syntax parser evaluate for the container query syntax. We have to decide between these 2 I think:
<style>
media-controller {
container: media-chrome / inline-size;
}
.small,
.large {
display: none;
}
@container (inline-size < 420px) {
.small {
display: block;
}
.large {
display: none;
}
}
@container (inline-size > 590px) {
.small {
display: none;
}
.large {
display: block;
}
}
</style>
<media-controller>
<slot name="media" slot="media"></slot>
<template if="type == 'on-demand'" class="small"></template>
<template if="type == 'on-demand'" class="large"></template>
</media-controller>
<media-controller>
<slot name="media" slot="media"></slot>
<template if="type == 'on-demand' && width < 420"></template>
<template if="type == 'on-demand' && width > 590"></template>
</media-controller> I'm leaning to option 2. Requires less code for the user, simpler, less hacky. Started beefing up our expression logic here #383 |
Beta Was this translation helpful? Give feedback.
-
ok we decided we're going to start with a simpler syntax that should give enough power and flexibility. the next decision is about how we want the Both solutions involve adding some new params to the templates. <template if="containerSize >= sm">
<template if="containerSize <= md"></template>
</template> a. <template if="breakpointSm">
<template if="notBreakpointMd"></template>
</template> b. <template if="breakpointSm">
<template if="!breakpointMd"></template>
</template> |
Beta Was this translation helpful? Give feedback.
-
It seems like every theme will have a need for handling responsiveness. What we're doing with Mux Player is something like this proposed in #369 :
Alt syntax in an earlier iteration is:
The user of this theme would have to pass in the
large
size as an attribute. What is cumbersome here is that the user of the theme has to keep track of the containers size and update the attribute accordingly, resulting in a lot of boilerplate code with resize observers.It seems to me like the theme should be able to keep track of that (and the theme author can decide on the breakpoints, which are important for the overall design of the theme).
Proposal
Something where I can use familiar media-query syntax to tell the theme to only render a certain layout
Open to any and all possible iterations of the syntax, but the main thing I'm getting at is that the theme author, a designer working with HTML and CSS is able to specify breakpoints in the template.
Beta Was this translation helpful? Give feedback.
All reactions