question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A possible bug (or a misunderstanding of the API)

See original GitHub issue

I just started using this lib and I’m a little bit confused by the API. The docs give two examples with the md breakpoint and the up and down functions respectively. The first example seems clear to me: ${up('md')} translates to @media (min-width: 768px). But in the second example, ${down('md')} translates to @media (max-width: 991.98px) whereas I would have expected @media (max-width: 767.98px) (also see the screenshot below). On a given viewport width of 800px, both useBreakpoint(up('md')) and useBreakpoint(down('md')) return true at the same time. Maybe I’m understanding the API wrong, but shouldn’t they be mutually exclusive? I’d expect the latter to be false. Merry Christmas and thank you in advance for your help 🙏

image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pierreburelcommented, Jan 12, 2022

Hey, i’m afraid i have to agree with @SyFlo: the API for down feels weird, especially since it’s not how Bootstrap works.

bootstrap:

@include media-breakpoint-down(md) = @media (max-width: 767.98px) (= down("sm")) @include media-breakpoint-up(md) = @media (min-width: 768px)

styled-breakpoints:

down("md") = @media (max-width: 991.98px) (= @include media-breakpoint-down(lg)) up("md") = @media (min-width: 768px)

Here’s a (crude) demo showing the differences: https://codesandbox.io/s/angry-boyd-vfn1k

There’s also a difference with between.

bootstrap: @include media-breakpoint-between(sm, md) = @media (min-width: 576px) and (max-width: 767.98px)
styled-breakpoints: between("sm", "md") = @media (min-width: 576px) and (max-width: 991.98px)

But tbh i don’t really know how you could possibly align with Bootstrap without breaking changes… or maybe by providing alternative downInclusive and betweenInclusive methods (sorry i’m not good at naming things)?

1reaction
SyFlocommented, Jan 3, 2022

@mg901 Thank you for your answer and sorry for the delay, I’ve been away from keyboard over the last few days. Sure, I can work with that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug #43972 for WWW-Facebook-API: Possible bug -- but could be ...
Greetings! I am trying to use WWW::Facebook::API and i cannot seem to even get to first base with it. Here is my sample...
Read more >
Not sold! The end user does not care whose fault it is!
The problem is with the docs being written in English, it is not clear what is a API bug, and what is a...
Read more >
Possible API bug with GSComponent.automaticAlignment - bug ...
Possible API bug with GSComponent.automaticAlignment ... It's possible I'm misunderstanding the intention of automaticAlignment though.
Read more >
"Limit results" in Asset Management and Tagging API v2 does ...
I am wondering if this has been determined to be a bug, either by you or someone from Qualys? If not what is...
Read more >
'[LLVMdev] Possible bug or misunderstanding of feature ...
... llvm-dev Subject: [LLVMdev] Possible bug or misunderstanding of feature ... the c api to get a integer of arbitrary size from a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found