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

Commit b8001d4

Browse files
author
Jen Downs
committed
feat(utilities): Added breakspointsAndArtboards variable, modified fluid util functions. Updated error logic.
1 parent 153cb8f commit b8001d4

File tree

11 files changed

+36
-24
lines changed

11 files changed

+36
-24
lines changed
Binary file not shown.

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/// @param {String} $breakpointName Breakpoint name.
77
/// @return {Length} The breakpoint value in rems.
88
@function getBreakpointValue($breakpointName) {
9-
$breakpointValue: map-deep-get($allBreakpoints, $breakpointName, 'breakpoint');
9+
$breakpointValue: map-deep-get($breakpointsAndArtboards, $breakpointName, 'breakpoint');
1010

1111
@return $breakpointValue * 1rem;
1212
}
@@ -29,14 +29,15 @@
2929
/// }
3030
/// }
3131
@function getFluidSize($breakpointName, $columnSpan) {
32-
$breakpoint: map-get($allBreakpoints, $breakpointName);
33-
$columnTotal: map-get($breakpoint, columns);
34-
$margin: map-get($breakpoint, margin);
32+
$breakpoint: map-get($breakpointsAndArtboards, $breakpointName);
3533

36-
@if ($breakpoint == null) {
34+
@if ($breakpoint == null or type-of($breakpoint) != 'map') {
3735
@error 'The provided breakpoint `#{$breakpointName}` is not a valid breakpoint found in breakpoints or extraArtboards in $grid-values. Please double-check your grid configuration.';
3836
}
3937

38+
$columnTotal: map-get($breakpoint, columns);
39+
$margin: map-get($breakpoint, margin);
40+
4041
@if ($columnTotal == null or type-of($columnTotal) != 'number') {
4142
@error 'The provided breakpoint `#{$breakpointName}` needs to have a total number of columns set in $grid-values. Please double-check your grid configuration.';
4243
}
@@ -92,4 +93,4 @@
9293
@media screen and (min-width: #{getBreakpointValue($breakpointName)}) {
9394
@content;
9495
}
95-
}
96+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ $last: nth(nth($breakpoints, -1), 2);
1111
$includeFlexFallback: false !default;
1212
$rowHeight: map-get($grid-values, "rowHeight");
1313
$rows: map-get($grid-values, "rows");
14+
$extraArtboards: map-get($grid-values, "extraArtboards");
1415
$allBreakpoints: allBreakpoints($breakpoints, $extraBreakpoints, $first, $last);
16+
$breakpointsAndArtboards: allBreakpoints($breakpoints, $extraArtboards, $first, $last);
0 Bytes
Binary file not shown.

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/// @param {String} $breakpointName Breakpoint name.
77
/// @return {Length} The breakpoint value in rems.
88
@function getBreakpointValue($breakpointName) {
9-
$breakpointValue: map-deep-get($allBreakpoints, $breakpointName, 'breakpoint');
9+
$breakpointValue: map-deep-get($breakpointsAndArtboards, $breakpointName, 'breakpoint');
1010

1111
@return $breakpointValue * 1rem;
1212
}
@@ -29,14 +29,15 @@
2929
/// }
3030
/// }
3131
@function getFluidSize($breakpointName, $columnSpan) {
32-
$breakpoint: map-get($allBreakpoints, $breakpointName);
33-
$columnTotal: map-get($breakpoint, columns);
34-
$margin: map-get($breakpoint, margin);
32+
$breakpoint: map-get($breakpointsAndArtboards, $breakpointName);
3533

36-
@if ($breakpoint == null) {
34+
@if ($breakpoint == null or type-of($breakpoint) != 'map') {
3735
@error 'The provided breakpoint `#{$breakpointName}` is not a valid breakpoint found in breakpoints or extraArtboards in $grid-values. Please double-check your grid configuration.';
3836
}
3937

38+
$columnTotal: map-get($breakpoint, columns);
39+
$margin: map-get($breakpoint, margin);
40+
4041
@if ($columnTotal == null or type-of($columnTotal) != 'number') {
4142
@error 'The provided breakpoint `#{$breakpointName}` needs to have a total number of columns set in $grid-values. Please double-check your grid configuration.';
4243
}
@@ -92,4 +93,4 @@
9293
@media screen and (min-width: #{getBreakpointValue($breakpointName)}) {
9394
@content;
9495
}
95-
}
96+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ $last: nth(nth($breakpoints, -1), 2);
1111
$includeFlexFallback: false !default;
1212
$rowHeight: map-get($grid-values, "rowHeight");
1313
$rows: map-get($grid-values, "rows");
14+
$extraArtboards: map-get($grid-values, "extraArtboards");
1415
$allBreakpoints: allBreakpoints($breakpoints, $extraBreakpoints, $first, $last);
16+
$breakpointsAndArtboards: allBreakpoints($breakpoints, $extraArtboards, $first, $last);
Binary file not shown.

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/// @param {String} $breakpointName Breakpoint name.
77
/// @return {Length} The breakpoint value in rems.
88
@function getBreakpointValue($breakpointName) {
9-
$breakpointValue: map-deep-get($allBreakpoints, $breakpointName, 'breakpoint');
9+
$breakpointValue: map-deep-get($breakpointsAndArtboards, $breakpointName, 'breakpoint');
1010

1111
@return $breakpointValue * 1rem;
1212
}
@@ -29,14 +29,15 @@
2929
/// }
3030
/// }
3131
@function getFluidSize($breakpointName, $columnSpan) {
32-
$breakpoint: map-get($allBreakpoints, $breakpointName);
33-
$columnTotal: map-get($breakpoint, columns);
34-
$margin: map-get($breakpoint, margin);
32+
$breakpoint: map-get($breakpointsAndArtboards, $breakpointName);
3533

36-
@if ($breakpoint == null) {
34+
@if ($breakpoint == null or type-of($breakpoint) != 'map') {
3735
@error 'The provided breakpoint `#{$breakpointName}` is not a valid breakpoint found in breakpoints or extraArtboards in $grid-values. Please double-check your grid configuration.';
3836
}
3937

38+
$columnTotal: map-get($breakpoint, columns);
39+
$margin: map-get($breakpoint, margin);
40+
4041
@if ($columnTotal == null or type-of($columnTotal) != 'number') {
4142
@error 'The provided breakpoint `#{$breakpointName}` needs to have a total number of columns set in $grid-values. Please double-check your grid configuration.';
4243
}
@@ -92,4 +93,4 @@
9293
@media screen and (min-width: #{getBreakpointValue($breakpointName)}) {
9394
@content;
9495
}
95-
}
96+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ $last: nth(nth($breakpoints, -1), 2);
1111
$includeFlexFallback: false !default;
1212
$rowHeight: map-get($grid-values, "rowHeight");
1313
$rows: map-get($grid-values, "rows");
14+
$extraArtboards: map-get($grid-values, "extraArtboards");
1415
$allBreakpoints: allBreakpoints($breakpoints, $extraBreakpoints, $first, $last);
16+
$breakpointsAndArtboards: allBreakpoints($breakpoints, $extraArtboards, $first, $last);

src/scss/_utilities.scss

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/// @param {String} $breakpointName Breakpoint name.
77
/// @return {Length} The breakpoint value in rems.
88
@function getBreakpointValue($breakpointName) {
9-
$breakpointValue: map-deep-get($allBreakpoints, $breakpointName, 'breakpoint');
9+
$breakpointValue: map-deep-get($breakpointsAndArtboards, $breakpointName, 'breakpoint');
1010

1111
@return $breakpointValue * 1rem;
1212
}
@@ -29,14 +29,15 @@
2929
/// }
3030
/// }
3131
@function getFluidSize($breakpointName, $columnSpan) {
32-
$breakpoint: map-get($allBreakpoints, $breakpointName);
33-
$columnTotal: map-get($breakpoint, columns);
34-
$margin: map-get($breakpoint, margin);
32+
$breakpoint: map-get($breakpointsAndArtboards, $breakpointName);
3533

36-
@if ($breakpoint == null) {
34+
@if ($breakpoint == null or type-of($breakpoint) != 'map') {
3735
@error 'The provided breakpoint `#{$breakpointName}` is not a valid breakpoint found in breakpoints or extraArtboards in $grid-values. Please double-check your grid configuration.';
3836
}
3937

38+
$columnTotal: map-get($breakpoint, columns);
39+
$margin: map-get($breakpoint, margin);
40+
4041
@if ($columnTotal == null or type-of($columnTotal) != 'number') {
4142
@error 'The provided breakpoint `#{$breakpointName}` needs to have a total number of columns set in $grid-values. Please double-check your grid configuration.';
4243
}
@@ -92,4 +93,4 @@
9293
@media screen and (min-width: #{getBreakpointValue($breakpointName)}) {
9394
@content;
9495
}
95-
}
96+
}

0 commit comments

Comments
 (0)