Git Product home page Git Product logo

Comments (4)

WickyNilliams avatar WickyNilliams commented on August 24, 2024 3

Possible solutions:

  1. add some sort of media-query prop, which defines the breakpoint at which mobile layout is shown (or the inverse, if we want to be mobile first).
    • pros:
      • explicit and clear where value comes from
      • allows for media query to be changed and adjusted at runtime (not sure that's valuable tbh)
    • cons:
      • feels weird having a media query in a property/attribute/html
      • need to ensure this prop is set on every instance of the component for consistency
  2. read a media query from some pre-defined CSS variable e.g. --duet-media-query
    • pros:
      • set once and all instances of the component will use the same value
      • feels more natural to define a media query in css (could also be defined in html via style attribute)
    • cons:
      • implicit and not very clear where value comes from
      • does not allow for media query to be changed and adjusted at runtime (much like regular media queries, so i don't think it's a drawback)

Both of these would ultimately pass the value to matchMedia. I am leaning towards option 2 since it's more natural to specify in CSS and every instance will naturally use the same value that way

from date-picker.

WickyNilliams avatar WickyNilliams commented on August 24, 2024

Hmm this is a good point, but I'm not sure how to solve it... You can't use CSS vars in media queries so it's not something that can be passed in easily. I'll have a think

from date-picker.

jackazadian1 avatar jackazadian1 commented on August 24, 2024

option 2 is exactly what I had in mind when I was looking for a solution.

from date-picker.

zellerbaptiste avatar zellerbaptiste commented on August 24, 2024

Hi,
any update on that subject ?
Option 1 would work perfectly for me.

from date-picker.

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.