Skip to content

Instantly share code, notes, and snippets.

@joekolade
Created April 8, 2023 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joekolade/9ee51286ed6f1b89f0ff6d8595946960 to your computer and use it in GitHub Desktop.
Save joekolade/9ee51286ed6f1b89f0ff6d8595946960 to your computer and use it in GitHub Desktop.
[Breakpoints mixins]
/**
Breakpoints
*/
// define breakpoints
// ------------------------------
$breakpoints: (
micro: 320px,
xs: 502px,
sm: 768px,
md: 992px,
lg: 1080px,
xl: 1280px,
xxl: 1620px
);
@mixin breakpoint($breakpoint: md){
@if map-has-key($breakpoints, $breakpoint) {
@media screen and (min-width: map_get($breakpoints, $breakpoint)) {
@content;
}
}
@else {
@media screen and (min-width: $breakpoint) {
@content;
}
}
}
@mixin breakpointUp($breakpoint: micro){
@if map-has-key($breakpoints, $breakpoint) {
@media screen and (max-width: map_get($breakpoints, $breakpoint)) {
@content;
}
}
@else {
@media screen and (max-width: $breakpoint) {
@content;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment