[@thumbtack/thumbprint-scss]: Make responsive mixins easier to use from memory
See original GitHub issueIn 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:
- Created 5 years ago
- Comments:6 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.Yeah, doesn’t look like the usage of these is frequent enough to warrant a big change.