graycoreio/daffodil

View on GitHub
libs/design/scss/layout/_breakpoint.scss

Summary

Maintainability
Test Coverage
@use 'sass:map';
@use 'variables' as v;

//
// Take a the list of breakpoints and retrieves the defined point.
// If an invalid breakpoint is defined, it will display a warning.
//
// @usage
// ```
// @include layout.breakpoint(mobile) {}
// ```
//
@mixin breakpoint($point) {
    @if not map.has-key($map: v.$breakpoints, $key: $point) {
        @warn 'breakpoint(): "#{$key}" is not defined in your $breakpoints setting.';
    }

    @media (min-width: map.get(v.$breakpoints, $point)) {
        @content;
    }
}