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.

[@thumbtack/thumbprint-scss]: Make responsive mixins easier to use from memory

See original GitHub issue

In my opinion, it’s difficult to use the tp-respond-below and tp-respond-above mixins purely from memory because with the $tp variables, it’s actually quite verbose. I generally resort to copying and pasting them from some other code, which is a minor annoyance.

On the helpcenter repo we’ve been using the following convenience methods, which I find a lot easier to remember:

@import 'node_modules/@thumbtack/thumbprint-scss/mixins';

$breakpoints: (
  small: $tp-breakpoint__small,
  medium: $tp-breakpoint__medium,
  large: $tp-breakpoint__large,
);

@mixin respond-above($width) {
  @include tp-respond-above(map-get($breakpoints, $width)) {
    @content;
  }
}

@mixin respond-below($width) {
  @include tp-respond-below(map-get($breakpoints, $width)) {
    @content;
  }
}
// Usage:

.component {
  @include respond-above(medium) {
    // ...
  }
}

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
tomgenonicommented, Mar 7, 2019

Yeah, we do global migrations caused by breaking changes somewhat regularly. At this point our tp-* classes are only used on legacy pages or as backups where the React component either doesn’t exist or is insufficient, so converting this to something terser, like we did with the Atomic classes, makes sense.

0reactions
tomgenonicommented, Jan 7, 2020

Yeah, doesn’t look like the usage of these is frequent enough to warrant a big change.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing Media Queries with Sass Mixins | by Timothy Robards
Media queries are one of the techniques we can use to help ensure our layouts ... Sass mixins give us the ability to...
Read more >
The Best Way to Facilitate CSS Media Queries using SCSS ...
This article will explain how to create media queries using SCSS mixins. It will also show how to use the @include function to...
Read more >
Responsive Mixins | Bulma
These responsive mixins are named after the screen sizes and breakpoints used in Bulma, so that you can use them to create a...
Read more >
Zurb Foundation 4 SCSS mixins for small and large(fluid ...
This mixin provides an easy way to use the F4 grid classes and media-queries. $phone-grid: number of grid columns. $desktop-grid: number of grid...
Read more >
zellwk/typi: A sass mixin to make responsive typography easy
Typi can help you create classes automatically if you use the typi-create-classes mixin. It extracts the keys present in your $typi map and...
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