Debian Codegraph @

debian/missing-sources/bourbon-neat/app/assets/stylesheets/functions/_new-breakpoint.scss

raw
1 @charset "UTF-8";
2
3 /// Returns a media context (media query / grid context) that can be stored in a variable and passed to `media()` as a single-keyword argument. Media contexts defined using `new-breakpoint` are used by the visual grid, as long as they are defined before importing Neat.
4 ///
5 /// @param {List} $query
6 /// A list of media query features and values. Each `$feature` should have a corresponding `$value`.
7 ///
8 /// If there is only a single `$value` in `$query`, `$default-feature` is going to be used.
9 ///
10 /// The number of total columns in the grid can be set by passing `$columns` at the end of the list (overrides `$total-columns`). For a list of valid values for `$feature`, click [here](http://www.w3.org/TR/css3-mediaqueries/#media1).
11 ///
12 /// @param {Number (unitless)} $total-columns [$grid-columns]
13 /// - Number of columns to use in the new grid context. Can be set as a shorthand in the first parameter.
14 ///
15 /// @example scss - Usage
16 /// $mobile: new-breakpoint(max-width 480px 4);
17 ///
18 /// .element {
19 /// @include media($mobile) {
20 /// @include span-columns(4);
21 /// }
22 /// }
23 ///
24 /// @example css - CSS Output
25 /// @media screen and (max-width: 480px) {
26 /// .element {
27 /// display: block;
28 /// float: left;
29 /// margin-right: 7.42297%;
30 /// width: 100%;
31 /// }
32 /// .element:last-child {
33 /// margin-right: 0;
34 /// }
35 /// }
36
37 @function new-breakpoint($query: $feature $value $columns, $total-columns: $grid-columns) {
38 @if length($query) == 1 {
39 $query: $default-feature nth($query, 1) $total-columns;
40 } @else if is-even(length($query)) {
41 $query: append($query, $total-columns);
42 }
43
44 @if is-not(belongs-to($query, $visual-grid-breakpoints)) {
45 $visual-grid-breakpoints: append($visual-grid-breakpoints, $query, comma) !global;
46 }
47
48 @return $query;
49 }