Coder Social home page Coder Social logo

Comments (11)

iRyanBell avatar iRyanBell commented on May 14, 2024 3

@iRyanBell maybe these videos will help you think mobile first.
video
book

Bootstrap
Снимок экрана 2020-11-22 в 12 36 33

Zurb Foundation
Снимок экрана 2020-11-22 в 12 37 27

I'm totally on board with a mobile-first mindset for cascading styles by additive viewport width.

My complaint here was largely around the naming convention of up(Md) meaning "greater than the 'md' width definition", while down(Md) translates non-symmetrically to "less than next higher definition after 'md'" -- I get the logic behind this model, seeing breakpoints as ranges, but I would prefer a more precise interpretation.

from styled-breakpoints.

mg901 avatar mg901 commented on May 14, 2024 1

@iRyanBell, good time. Thanks for using style-breakpoints. All of the above problems only arise because you ignore the mobile first approach. The existing api is enough to cover all your needs.

from styled-breakpoints.

mg901 avatar mg901 commented on May 14, 2024 1

Can you elaborate more on the mobile first approach?

It's not quite clear to me why up('md') is relative to md (up from md). And down('md') performs down from lg.

Mobile first - from smallest to largest.
Desktop first - from largest to smallest.

from styled-breakpoints.

mg901 avatar mg901 commented on May 14, 2024 1

@iRyanBell "Desktop first" has many drawbacks. If following the "mobile first" principle you add the functionality you need, then in "desktop first" you need to hide what you already have and you constantly have to write display: none;

from styled-breakpoints.

mg901 avatar mg901 commented on May 14, 2024 1

@iRyanBell maybe these videos will help you think mobile first.
video
book

Bootstrap
Снимок экрана 2020-11-22 в 12 36 33

Zurb Foundation
Снимок экрана 2020-11-22 в 12 37 27

from styled-breakpoints.

iRyanBell avatar iRyanBell commented on May 14, 2024

Can you elaborate more on the mobile first approach?

It's not quite clear to me why up('md') is relative to md (up from md). And down('md') performs down from lg.

from styled-breakpoints.

mg901 avatar mg901 commented on May 14, 2024

@iRyanBell if you have any difficulties with solving existing problems, please send a link with an example code to codesandbox / stackblitz. I will gladly help you.

from styled-breakpoints.

iRyanBell avatar iRyanBell commented on May 14, 2024

@iRyanBell if you have any difficulties with solving existing problems, please send a link with an example code to codesandbox / stackblitz. I will gladly help you.

How would you ideally query down from sm (ie. a width no greater than a max value of 576px), given the breakpoints definition of:

{
  sm: '576px',
  md: '768px',
  lg: '992px',
  xl: '1200px',
}

from styled-breakpoints.

mg901 avatar mg901 commented on May 14, 2024

@iRyanBell take a look at this example.

from styled-breakpoints.

iRyanBell avatar iRyanBell commented on May 14, 2024

@iRyanBell take a look at this example.

Ah, I see what you mean now by the mobile first approach! That works, just using up which references the supplied breakpoint rather than trying to use down which picks a different breakpoint value.

So, from this perspective, you can't write a media query < sm (or your lowest breakpoint) with down as a sort of "it's a feature, not a bug" mentality. Closing as resolved. Although, I still like the idea of a down by referenced breakpoint rather than the next-higher breakpoint by index.

from styled-breakpoints.

mg901 avatar mg901 commented on May 14, 2024

@iRyanBell, I understand you, but I didn’t come up with the names for these functions myself. The styled-breakpoints API completely copies the media query api from bootstrap (145k stars). So we can say with complete confidence that this is the standard for the industry. Yes, English is not my first language, but bootstrap was invented in San Francisco. For some reason, I have no doubts about the correctness of the name.)) Thanks again for your interest.)) Perhaps, to fix the problem with down, you need to add another breakpoint

  xs: '0px',
  sm: '576px',
  md: '768px',
  lg: '992px',
  xl: '1200px',
}

similar to Zurb Foundation media queries.

Then your problem will be solved. Hmm ... Perhaps this is a great reason to think.

from styled-breakpoints.

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.