Giter VIP home page Giter VIP logo

Comments (7)

Akryum avatar Akryum commented on August 11, 2024 1

Maybe we can have an hybrid approach and use iframe only when we want responsive queries to apply?

from histoire.

elevatebart avatar elevatebart commented on August 11, 2024

Great idea to put to debate. Thanks.

What is the rationale for not using iframes?

This is how storybook and cypress handle media queries testing so you can bet that browser support is going to stay. Container queries on the other hand are still not used enough to be stable in API.

Using them instead to test Media queries would meant doing some CSS rewriting. I don't mind doing this magic (with sourcemaps of course) if we have a stable API on the other hand.

from histoire.

hugoattal avatar hugoattal commented on August 11, 2024

After discussing it with @Akryum, it cames that iframes would be kinda heavy, especially with several versions of an element in a story, and might slow down the hot reload and the whole page.

But you're right, usage of iframes should also be put to debate! The advantage being that we won't need anything special to handle media queries.

Small example to illustrate, imagine an iframe for each element of this page:
https://vuejs.github.io/ui/#/demo/button

from histoire.

Akryum avatar Akryum commented on August 11, 2024

it cames that iframes would be kinda heavy

Specifically for the grid view where 10 or 100s of the component can be displayed at once.

from histoire.

Akryum avatar Akryum commented on August 11, 2024

image

from histoire.

BBoehm avatar BBoehm commented on August 11, 2024

Would be great if we can get some kind of solution for the container queries

from histoire.

hugoattal avatar hugoattal commented on August 11, 2024

This seems to now be commonly supported: https://caniuse.com/css-container-queries

So, the solution would be to just add a css rule on the variant like this:

.variant {
    container: variant / size
}

But then you'll have to use the @container query instead of the @media query.

ex:

@container (min-width: 720px) {
    .child {...}
}

(The usual media query would still work of course) Wdyt?

from histoire.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.