sass-site/source/assets/sass/_breakpoints.scss

85 lines
1.7 KiB
SCSS
Raw Normal View History

2023-01-12 20:54:24 +01:00
@use 'functions';
2023-01-12 19:19:42 +01:00
2023-01-09 20:10:02 +01:00
$sl-breakpoint--small: 480px !default;
$sl-breakpoint--medium: 640px !default;
$sl-breakpoint--large: 960px !default;
2023-01-06 22:40:29 +01:00
$sl-breakpoint--x-large: 1280px !default;
$sl-breakpoints: (
2023-01-09 20:10:02 +01:00
// for mixins to span across breakpoints and without one
none: 0,
small: $sl-breakpoint--small,
medium: $sl-breakpoint--medium,
large: $sl-breakpoint--large,
x-large: $sl-breakpoint--x-large
2023-01-06 22:40:29 +01:00
);
@mixin sl-breakpoint($breakpoint) {
2023-01-12 19:19:42 +01:00
@media only screen and (min-width: #{functions.sl-px-to-em($breakpoint)}) {
2023-01-06 22:40:29 +01:00
@content;
}
}
@mixin sl-breakpoint-max($breakpoint) {
2023-01-12 19:19:42 +01:00
@media only screen and (max-width: #{functions.sl-px-to-em($breakpoint)}) {
2023-01-06 22:40:29 +01:00
@content;
}
}
@mixin sl-breakpoint--small {
@include sl-breakpoint($sl-breakpoint--small) {
@content;
}
}
@mixin sl-breakpoint--small-max {
@include sl-breakpoint-max($sl-breakpoint--small) {
@content;
}
}
@mixin sl-breakpoint--medium {
@include sl-breakpoint($sl-breakpoint--medium) {
@content;
}
}
@mixin sl-breakpoint--medium-max {
@include sl-breakpoint-max($sl-breakpoint--medium) {
@content;
}
}
@mixin sl-breakpoint--large {
@include sl-breakpoint($sl-breakpoint--large) {
@content;
}
}
@mixin sl-breakpoint--large-max {
@include sl-breakpoint-max($sl-breakpoint--large) {
@content;
}
}
@mixin sl-breakpoint--x-large {
@include sl-breakpoint($sl-breakpoint--x-large) {
@content;
}
}
@mixin sl-breakpoint--x-large-max {
@include sl-breakpoint-max($sl-breakpoint--x-large) {
@content;
}
}
2023-01-09 20:10:02 +01:00
@mixin sl-breakpoint-set($breakpoint, $size) {
2023-01-06 22:40:29 +01:00
@if $breakpoint == none {
@content;
2023-01-09 20:10:02 +01:00
} @else {
2023-01-06 22:40:29 +01:00
@include sl-breakpoint($size) {
@content;
}
}
}