]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Merge branch 'develop' into feat/hidpi-breakpoints-9556
authorNicolas Coden <nicolas@ncoden.fr>
Fri, 22 Dec 2017 21:46:36 +0000 (22:46 +0100)
committerGitHub <noreply@github.com>
Fri, 22 Dec 2017 21:46:36 +0000 (22:46 +0100)
1  2 
scss/util/_breakpoint.scss

index 71fa44c0a616ed6520e462754b4b6e266f3a8781,8948c7baccc5bac417e0c6ff5cc7628028b21e86..8c422533be59cfa17a11c1d32f3834c013337fe6
@@@ -204,26 -226,53 +219,73 @@@ $breakpoint-classes: (small medium larg
  
  }
  
 +/// Find the next number in a map.
 +/// @access private
 +///
 +/// @param {Map} $map - Map to traverse.
 +/// @param {Mixed} $number - Number to use as a starting point.
 +///
 +/// @returns {Mixed} The number following `$number`, if `$number` was found. If `$number` was not found, or `$number` was the biggest number in the map, returns `null`.
 +@function -zf-map-next-number($map, $number) {
 +
 +  $next_number: null;
 +
 +  @each $k, $v in $map {
 +    @if type-of($v) == 'number' and $v > $number and ($next_number == null or $v < $next_number) {
 +      $next_number: $v;
 +    }
 +  }
 +
 +  @return $next_number;
 +}
 +
+ /// Return a list of our named breakpoints less than $key. Useful for dealing with
+ /// responsive gutters for the grid.
+ /// @access private
+ ///
+ /// @param {String} $key - Key to use as last breakpoint.
+ ///
+ /// @returns {Array} The list of breakpoints up to and. If $key is auto, returns breakpoints above the zero
+ @function -zf-breakpoints-less-than($key) {
+   $list: ();
+   $found_key: false;
+   @each $name in $-zf-breakpoints-keys {
+     @if ($name == $key) {
+       $found_key: true;
+     }
+     @if not $found_key {
+       $list: append($list, $name);
+     }
+   }
+   @return $list;
+ }
+ /// Return a list of our named breakpoints less than $key. Useful for dealing with
+ /// responsive gutters for the grid.
+ /// @access private
+ ///
+ /// @param {String} $breakpoing - a named or non-named breakpoing.
+ ///
+ /// @returns {Array} The list of breakpoints up to and. If $key is auto, returns breakpoints above the zero
+ @function -zf-closest-named-breakpoint($breakpoint) {
+   $last: $-zf-zero-breakpoint;
+   $found: false;
+   $value: unitless-calc($breakpoint, 1px);
+   @each $key, $val in $breakpoints {
+     @if not $found {
+       @if unitless-calc($val) > $value {
+         $found: true;
+       } @else {
+         $last: $key;
+       }
+     }
+   }
+   @return $last;
+ }
  /// Get a value for a breakpoint from a responsive config map or single value.
  /// - If the config is a single value, return it regardless of `$value`.
  /// - If the config is a map and has the key `$value`, the exact breakpoint value is returned.
    }
  }
  
 +/// Return media query string from the given min and/or max limits.
 +/// If a limit is equal to `null` or `0`, it is ignored.
 +/// @access private
 +///
 +/// @param {Number} $min [0] - Min media query limit.
 +/// @param {Number} $max [0] - Max media query limit.
 +/// @param {String} $min-name ['min-width'] - Name of the min media query limit.
 +/// @param {String} $delimiter ['max-width'] - Name of the max media query limit.
 +///
 +/// @returns {String} Media Query string.
 +@function -zf-bp-join(
 +  $min: 0,
 +  $max: 0,
 +  $min-name: 'min-width',
 +  $max-name: 'max-width'
 +) {
 +  @return zf-str-join(
 +    if($min and $min > 0, '(#{$min-name}: #{$min})', null),
 +    if($max and $max > 0, '(#{$max-name}: #{$max})', null),
 +    ' and ');
 +}
 +
+ $small-up: '';
+ $small-only: '';
  @if map-has-key($breakpoints, small) {
    $small-up: screen;
    $small-only: unquote('screen and #{breakpoint(small only)}');