Skip to content
This repository was archived by the owner on Jul 18, 2024. It is now read-only.

Commit 153cb8f

Browse files
author
Jen Downs
committed
fix(utilities): Moved map-deep-get to functions.scss. Removed sample breakpoint names from comments.
1 parent 1f58e4e commit 153cb8f

File tree

11 files changed

+64
-60
lines changed

11 files changed

+64
-60
lines changed
Binary file not shown.

examples/bootstrap/css-gridish/scss/_functions.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,15 @@ map-get($breakpoint, margin) != 0) {
195195

196196
@return if($minus, -$result, $result);
197197
}
198+
199+
/// Traverse maps and retrieve deeply nested values: https://css-tricks.com/snippets/sass/deep-getset-maps/
200+
/// @author Hugo Giraudel
201+
/// @param {Map} $map A sass map and any number of keys.
202+
/// @param {*} $keys Nested values.
203+
/// @return Nested values or nested map.
204+
@function map-deep-get($map, $keys...) {
205+
@each $key in $keys {
206+
$map: map-get($map, $key);
207+
}
208+
@return $map;
209+
}

examples/bootstrap/css-gridish/scss/_utilities.scss

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1-
@import 'variables';
1+
@import 'functions';
22
@import 'values';
3-
4-
/// Function from https://css-tricks.com/snippets/sass/deep-getset-maps/
5-
/// Helps you traverse maps and retrieve deeply nested values.
6-
/// @param {Map} $map A sass map and any number of keys.
7-
/// @param {*} $keys Nested values.
8-
/// @return Nested values or nested map.
9-
@function map-deep-get($map, $keys...) {
10-
@each $key in $keys {
11-
$map: map-get($map, $key);
12-
}
13-
@return $map;
14-
}
3+
@import 'variables';
154

165
/// Function returns the value for a given breakpoint.
17-
/// @param {String} $breakpointName Breakpoint name (sm, md, lg, xlg, max).
6+
/// @param {String} $breakpointName Breakpoint name.
187
/// @return {Length} The breakpoint value in rems.
198
@function getBreakpointValue($breakpointName) {
209
$breakpointValue: map-deep-get($allBreakpoints, $breakpointName, 'breakpoint');
@@ -23,7 +12,7 @@
2312
}
2413

2514
/// Returns a calc() expression that represents a fluid width at a given breakpoint.
26-
/// @param {String} $breakpointName A valid breakpoint (sm, md, lg, xlg, or max).
15+
/// @param {String} $breakpointName A valid breakpoint.
2716
/// @param {Number} $columnSpan The number of columns to span across.
2817
/// @return {Length} A calc() expression representing fluid width.
2918
/// @example scss
0 Bytes
Binary file not shown.

examples/carbon/css-gridish/scss/_functions.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,15 @@ map-get($breakpoint, margin) != 0) {
195195

196196
@return if($minus, -$result, $result);
197197
}
198+
199+
/// Traverse maps and retrieve deeply nested values: https://css-tricks.com/snippets/sass/deep-getset-maps/
200+
/// @author Hugo Giraudel
201+
/// @param {Map} $map A sass map and any number of keys.
202+
/// @param {*} $keys Nested values.
203+
/// @return Nested values or nested map.
204+
@function map-deep-get($map, $keys...) {
205+
@each $key in $keys {
206+
$map: map-get($map, $key);
207+
}
208+
@return $map;
209+
}

examples/carbon/css-gridish/scss/_utilities.scss

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1-
@import 'variables';
1+
@import 'functions';
22
@import 'values';
3-
4-
/// Function from https://css-tricks.com/snippets/sass/deep-getset-maps/
5-
/// Helps you traverse maps and retrieve deeply nested values.
6-
/// @param {Map} $map A sass map and any number of keys.
7-
/// @param {*} $keys Nested values.
8-
/// @return Nested values or nested map.
9-
@function map-deep-get($map, $keys...) {
10-
@each $key in $keys {
11-
$map: map-get($map, $key);
12-
}
13-
@return $map;
14-
}
3+
@import 'variables';
154

165
/// Function returns the value for a given breakpoint.
17-
/// @param {String} $breakpointName Breakpoint name (sm, md, lg, xlg, max).
6+
/// @param {String} $breakpointName Breakpoint name.
187
/// @return {Length} The breakpoint value in rems.
198
@function getBreakpointValue($breakpointName) {
209
$breakpointValue: map-deep-get($allBreakpoints, $breakpointName, 'breakpoint');
@@ -23,7 +12,7 @@
2312
}
2413

2514
/// Returns a calc() expression that represents a fluid width at a given breakpoint.
26-
/// @param {String} $breakpointName A valid breakpoint (sm, md, lg, xlg, or max).
15+
/// @param {String} $breakpointName A valid breakpoint.
2716
/// @param {Number} $columnSpan The number of columns to span across.
2817
/// @return {Length} A calc() expression representing fluid width.
2918
/// @example scss
Binary file not shown.

examples/material/css-gridish/scss/_functions.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,15 @@ map-get($breakpoint, margin) != 0) {
195195

196196
@return if($minus, -$result, $result);
197197
}
198+
199+
/// Traverse maps and retrieve deeply nested values: https://css-tricks.com/snippets/sass/deep-getset-maps/
200+
/// @author Hugo Giraudel
201+
/// @param {Map} $map A sass map and any number of keys.
202+
/// @param {*} $keys Nested values.
203+
/// @return Nested values or nested map.
204+
@function map-deep-get($map, $keys...) {
205+
@each $key in $keys {
206+
$map: map-get($map, $key);
207+
}
208+
@return $map;
209+
}

examples/material/css-gridish/scss/_utilities.scss

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1-
@import 'variables';
1+
@import 'functions';
22
@import 'values';
3-
4-
/// Function from https://css-tricks.com/snippets/sass/deep-getset-maps/
5-
/// Helps you traverse maps and retrieve deeply nested values.
6-
/// @param {Map} $map A sass map and any number of keys.
7-
/// @param {*} $keys Nested values.
8-
/// @return Nested values or nested map.
9-
@function map-deep-get($map, $keys...) {
10-
@each $key in $keys {
11-
$map: map-get($map, $key);
12-
}
13-
@return $map;
14-
}
3+
@import 'variables';
154

165
/// Function returns the value for a given breakpoint.
17-
/// @param {String} $breakpointName Breakpoint name (sm, md, lg, xlg, max).
6+
/// @param {String} $breakpointName Breakpoint name.
187
/// @return {Length} The breakpoint value in rems.
198
@function getBreakpointValue($breakpointName) {
209
$breakpointValue: map-deep-get($allBreakpoints, $breakpointName, 'breakpoint');
@@ -23,7 +12,7 @@
2312
}
2413

2514
/// Returns a calc() expression that represents a fluid width at a given breakpoint.
26-
/// @param {String} $breakpointName A valid breakpoint (sm, md, lg, xlg, or max).
15+
/// @param {String} $breakpointName A valid breakpoint.
2716
/// @param {Number} $columnSpan The number of columns to span across.
2817
/// @return {Length} A calc() expression representing fluid width.
2918
/// @example scss

src/scss/_functions.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,15 @@ map-get($breakpoint, margin) != 0) {
195195

196196
@return if($minus, -$result, $result);
197197
}
198+
199+
/// Traverse maps and retrieve deeply nested values: https://css-tricks.com/snippets/sass/deep-getset-maps/
200+
/// @author Hugo Giraudel
201+
/// @param {Map} $map A sass map and any number of keys.
202+
/// @param {*} $keys Nested values.
203+
/// @return Nested values or nested map.
204+
@function map-deep-get($map, $keys...) {
205+
@each $key in $keys {
206+
$map: map-get($map, $key);
207+
}
208+
@return $map;
209+
}

0 commit comments

Comments
 (0)