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

Commit fd79fc6

Browse files
author
Jen Downs
committed
chore(rename): Changed all scss functions and mixins from camel case to kebab case.
1 parent b8001d4 commit fd79fc6

23 files changed

+221
-345
lines changed
Binary file not shown.

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,24 @@ body {
8181
}
8282

8383
@each $name, $breakpoint in $allBreakpoints {
84-
@include gridBreakpointWrapper($breakpoint, $first) {
84+
@include grid-breakpoint-wrapper($breakpoint, $first) {
8585
@if $includeFlexFallback {
86-
@include gridLegacyZeros($breakpoint, $allBreakpoints, $name);
87-
@include gridLegacyColumns($breakpoint, $first, $last, $name, $allBreakpoints);
88-
@if isSameBreakpoint($breakpoint, $last) == false {
89-
@include gridLegacyHeights($name, $rows, $rowHeight);
86+
@include grid-legacy-zeros($breakpoint, $allBreakpoints, $name);
87+
@include grid-legacy-columns($breakpoint, $first, $last, $name, $allBreakpoints);
88+
@if is-same-breakpoint($breakpoint, $last) == false {
89+
@include grid-legacy-heights($name, $rows, $rowHeight);
9090
}
9191
}
9292

9393
@if (map-has-key($allBreakpoints, $name)) {
94-
@include gridMargin($breakpoint, $last);
95-
@include gridPadding($breakpoint);
96-
@include gridLegacyWrapper($includeFlexFallback) {
97-
@include gridColumns($breakpoint, $first, $last) {
94+
@include grid-margin($breakpoint, $last);
95+
@include grid-padding($breakpoint);
96+
@include grid-legacy-wrapper($includeFlexFallback) {
97+
@include grid-columns($breakpoint, $first, $last) {
9898
display: grid;
9999
grid-auto-rows: minmax($rowHeight * 1rem, min-content);
100100
}
101-
@include gridVariables($breakpoint, $first, $rows, $rowHeight);
101+
@include grid-variables($breakpoint, $first, $rows, $rowHeight);
102102
}
103103
}
104104
}

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

Lines changed: 11 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@import "sass-list-maps";
22

33
// Transform the gutter property into a padding property for web
4-
@function addPadding($breakpoints) {
4+
@function add-padding($breakpoints) {
55
$cleanBreakpoints: ();
66
@each $name, $breakpoint in $breakpoints {
77
$cleanBreakpoints: map-merge(
@@ -20,8 +20,8 @@
2020
}
2121

2222
// Merge standard and custom breakpoints into list
23-
@function allBreakpoints($breakpoints, $extraBreakpoints, $first, $last) {
24-
$allBreakpoints: $breakpoints;
23+
@function all-breakpoints($breakpoints, $extraBreakpoints, $first, $last) {
24+
$all-breakpoints: $breakpoints;
2525
@each $currentBreakpoint in $extraBreakpoints {
2626
$extraBreakpointName: nth($currentBreakpoint, 1);
2727
$extraBreakpointWidth: nth($currentBreakpoint, 2);
@@ -56,17 +56,17 @@
5656
$currentBreakpoint: (
5757
$extraBreakpointName: map-merge(nth($match, 2), (breakpoint: $extraBreakpointWidth))
5858
);
59-
$allBreakpoints: map-merge($allBreakpoints, $currentBreakpoint);
59+
$all-breakpoints: map-merge($all-breakpoints, $currentBreakpoint);
6060
}
6161

62-
@return maps-sort($allBreakpoints, breakpoint);
62+
@return maps-sort($all-breakpoints, breakpoint);
6363
}
6464

65-
@function columnStringWidth($string, $multiple) {
65+
@function column-string-width($string, $multiple) {
6666
@return 1rem;
6767
}
6868

69-
@function columnWidth($breakpoint, $first, $last, $i, $columnAmount) {
69+
@function column-width($breakpoint, $first, $last, $i, $columnAmount) {
7070
$columnSize: 100 / map-get($breakpoint, columns) * $i *
7171
map-get($breakpoint, columns) / $columnAmount;
7272
$margin: 0;
@@ -77,51 +77,20 @@
7777
@if (map-get($breakpoint, margin) != null and
7878
map-get($breakpoint, margin) != 0) {
7979
$columnSize: calc(
80-
(#{100vw} - #{$margin}) * #{roundDecimal($i / $columnAmount, 3, floor)}
80+
(#{100vw} - #{$margin}) * #{round-decimal($i / $columnAmount, 3, floor)}
8181
);
8282
$type: "";
8383
}
8484

8585
@return #{$columnSize}#{$type};
8686
}
8787

88-
@function isSameBreakpoint($a, $b) {
88+
@function is-same-breakpoint($a, $b) {
8989
@return map-get($a, breakpoint) == map-get($b, breakpoint);
9090
}
9191

9292
// _decimal.scss | MIT License | gist.github.com/terkel/4373420
93-
@function roundDecimal ($number, $digits: 0, $mode: round) {
94-
$n: 1;
95-
// $number must be a number
96-
@if type-of($number) != number {
97-
@warn '#{ $number } is not a number.';
98-
@return $number;
99-
}
100-
// $digits must be a unitless number
101-
@if type-of($digits) != number {
102-
@warn '#{ $digits } is not a number.';
103-
@return $number;
104-
} @else if not unitless($digits) {
105-
@warn '#{ $digits } has a unit.';
106-
@return $number;
107-
}
108-
@for $i from 1 through $digits {
109-
$n: $n * 10;
110-
}
111-
@if $mode == round {
112-
@return round($number * $n) / $n;
113-
} @else if $mode == ceil {
114-
@return ceil($number * $n) / $n;
115-
} @else if $mode == floor {
116-
@return floor($number * $n) / $n;
117-
} @else {
118-
@warn '#{ $mode } is undefined keyword.';
119-
@return $number;
120-
}
121-
}
122-
123-
// _decimal.scss | MIT License | gist.github.com/terkel/4373420
124-
@function roundDecimal ($number, $digits: 0, $mode: round) {
93+
@function round-decimal($number, $digits: 0, $mode: round) {
12594
$n: 1;
12695
// $number must be a number
12796
@if type-of($number) != number {
@@ -153,7 +122,7 @@ map-get($breakpoint, margin) != 0) {
153122

154123
/// String to number converter
155124
/// @author Hugo Giraudel
156-
@function stringToNumber($value) {
125+
@function string-to-number($value) {
157126
@if type-of($value) == "number" {
158127
@return $value;
159128
} @else if type-of($value) != "string" {

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

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Enclose content in appropiate media query
2-
@mixin gridBreakpointWrapper($breakpoint, $first) {
3-
@if isSameBreakpoint($breakpoint, $first) {
2+
@mixin grid-breakpoint-wrapper($breakpoint, $first) {
3+
@if is-same-breakpoint($breakpoint, $first) {
44
@content;
55
} @else {
66
@media (min-width: map-get($breakpoint, breakpoint) * 1rem) {
@@ -10,7 +10,7 @@
1010
}
1111

1212
// Set the width of a grid’s column
13-
@mixin gridColumns($breakpoint, $first, $last) {
13+
@mixin grid-columns($breakpoint, $first, $last) {
1414
@if (map-get($breakpoint, columns) != null) {
1515
$columnQuantity: map-get($breakpoint, columns);
1616
$columnSize: 100vw / $columnQuantity;
@@ -21,15 +21,15 @@
2121
$totalMargin: map-get($breakpoint, margin) * 2;
2222
}
2323

24-
@if isSameBreakpoint($breakpoint, $last) and map-get($last, margin) != null {
24+
@if is-same-breakpoint($breakpoint, $last) and map-get($last, margin) != null {
2525
$totalMargin: map-get($last, margin) * 2;
2626
}
2727

28-
@if isSameBreakpoint($breakpoint, $last) and $totalMargin != 0 {
28+
@if is-same-breakpoint($breakpoint, $last) and $totalMargin != 0 {
2929
$columnSize: calc(
3030
(#{map-get($breakpoint, breakpoint) * 1rem} - #{$totalMargin}) / #{$columnQuantity}
3131
);
32-
} @else if isSameBreakpoint($breakpoint, $last) {
32+
} @else if is-same-breakpoint($breakpoint, $last) {
3333
$columnSize: calc(
3434
#{map-get($breakpoint, breakpoint) * 1rem} / #{$columnQuantity}
3535
);
@@ -38,7 +38,7 @@
3838
}
3939

4040
.#{$prefix}-grid {
41-
@if isSameBreakpoint($breakpoint, $first) {
41+
@if is-same-breakpoint($breakpoint, $first) {
4242
@content;
4343
}
4444
grid-template-columns: repeat(auto-fill, $columnSize);
@@ -59,14 +59,14 @@
5959
}
6060

6161
// Generate variables for commonly used rows
62-
@mixin gridHeightsFixed($rows, $rowHeight) {
62+
@mixin grid-heights-fixed($rows, $rowHeight) {
6363
@for $i from 1 to $rows {
6464
--#{$prefix}-height-#{$i}: $i * $rowHeight * 1rem;
6565
}
6666
}
6767

6868
// Set the width of a grid’s column for legacy grid
69-
@mixin gridLegacyColumns($breakpoint, $first, $last, $name, $breakpoints) {
69+
@mixin grid-legacy-columns($breakpoint, $first, $last, $name, $breakpoints) {
7070
$columnValue: null;
7171
$columnSize: null;
7272
$totalMargin: 0;
@@ -76,7 +76,7 @@
7676
}
7777

7878
// Do not make class if last media query
79-
@if isSameBreakpoint($breakpoint, $last) == false {
79+
@if is-same-breakpoint($breakpoint, $last) == false {
8080
// Loop each breakpoint to insert previous breakpoint classes inside this breakpoint’s media query
8181
// Ex: Make sure .yourPrefix-grid__col--sm--2 has correct sizes in the lg media query
8282
@each $currentName, $currentBreakpoint in $breakpoints {
@@ -87,15 +87,15 @@
8787
// Loop each column in current breakpoint for new class
8888
// Ex: .yourPrefix-grid__col--sm--1, .yourPrefix-grid__col--sm--2, etc.
8989
@for $i from 1 through map-get($currentBreakpoint, columns) {
90-
$columnSize: columnWidth(
90+
$columnSize: column-width(
9191
$breakpoint,
9292
$first,
9393
$last,
9494
$i,
9595
$columnAmount
9696
);
9797

98-
$isSecondToLast: isSameBreakpoint(
98+
$isSecondToLast: is-same-breakpoint(
9999
$breakpoint,
100100
nth(nth($breakpoints, length($breakpoints) - 1), 2)
101101
);
@@ -138,15 +138,15 @@
138138
}
139139
}
140140

141-
@if isSameBreakpoint($breakpoint, $last) {
141+
@if is-same-breakpoint($breakpoint, $last) {
142142
[class*="#{$prefix}-grid__col--"] {
143143
min-width: 0;
144144
}
145145
}
146146
}
147147

148148
// Set the height of an item for legacy grid
149-
@mixin gridLegacyHeights($name, $rows, $rowHeight) {
149+
@mixin grid-legacy-heights($name, $rows, $rowHeight) {
150150
.#{$prefix}-grid__height--#{$name}--0 {
151151
height: 0;
152152
}
@@ -158,7 +158,7 @@
158158
}
159159

160160
// If we need legacy grid, wrap this content in support tag
161-
@mixin gridLegacyWrapper($includeFlexFallback) {
161+
@mixin grid-legacy-wrapper($includeFlexFallback) {
162162
@if $includeFlexFallback {
163163
@supports (display: grid) {
164164
@content;
@@ -169,7 +169,7 @@
169169
}
170170

171171
// Generate all classes for 0 and 0-only displaying, including custom breakpoints if they exist
172-
@mixin gridLegacyZeros($breakpoint, $breakpoints, $name) {
172+
@mixin grid-legacy-zeros($breakpoint, $breakpoints, $name) {
173173
// Undo previous breakpoint’s 0--only class
174174
$onlyCorrectionFound: false;
175175
@for $i from length($breakpoints) *-1 through -1 {
@@ -195,7 +195,7 @@
195195

196196
// Set the width of a grid’s margin
197197
// and allow for a child to break out of the grid’s margin
198-
@mixin gridMargin($breakpoint, $last) {
198+
@mixin grid-margin($breakpoint, $last) {
199199
@if map-get($breakpoint, margin) != null and map-get($breakpoint, margin) > 0 {
200200
$margin: #{map-get($breakpoint, margin)};
201201

@@ -205,7 +205,7 @@
205205
}
206206

207207
.#{$prefix}-grid.#{$prefix}-grid--bleed {
208-
@if isSameBreakpoint($breakpoint, $last) {
208+
@if is-same-breakpoint($breakpoint, $last) {
209209
$maxBleed: "(100vw - #{map-get($breakpoint, breakpoint) * 1rem}) / -2";
210210
margin-left: calc(#{$maxBleed} - #{$margin});
211211
margin-right: calc(#{$maxBleed} - #{$margin});
@@ -230,7 +230,7 @@
230230
margin-right: -$margin;
231231
}
232232

233-
@include gridLegacyWrapper($includeFlexFallback) {
233+
@include grid-legacy-wrapper($includeFlexFallback) {
234234
.#{$prefix}-grid__break--left {
235235
margin-left: -$margin;
236236
}
@@ -243,7 +243,7 @@
243243
}
244244

245245
// Classnames for different padding options
246-
@mixin gridPadding($breakpoint) {
246+
@mixin grid-padding($breakpoint) {
247247
@if (map-get($breakpoint, padding) != null) {
248248
$padding: map-get($breakpoint, padding);
249249

@@ -280,10 +280,10 @@
280280
}
281281

282282
// Use all CSS Variable mixins
283-
@mixin gridVariables($breakpoint, $first, $rows, $rowHeight) {
284-
@if isSameBreakpoint($breakpoint, $first) {
283+
@mixin grid-variables($breakpoint, $first, $rows, $rowHeight) {
284+
@if is-same-breakpoint($breakpoint, $first) {
285285
:root {
286-
@include gridHeightsFixed($rows, $rowHeight);
286+
@include grid-heights-fixed($rows, $rowHeight);
287287
}
288288
}
289289
}

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/// Function returns the value for a given breakpoint.
66
/// @param {String} $breakpointName Breakpoint name.
77
/// @return {Length} The breakpoint value in rems.
8-
@function getBreakpointValue($breakpointName) {
8+
@function get-breakpoint-value($breakpointName) {
99
$breakpointValue: map-deep-get($breakpointsAndArtboards, $breakpointName, 'breakpoint');
1010

1111
@return $breakpointValue * 1rem;
@@ -18,8 +18,8 @@
1818
/// @example scss
1919
/// @media screen and (min-width: 20rem) {
2020
/// button {
21-
/// @include mediaQuery('sm') {
22-
/// max-width: getFluidSize('sm', 1);
21+
/// @include media-query('sm') {
22+
/// max-width: get-fluid-size('sm', 1);
2323
/// }
2424
/// }
2525
/// @output css
@@ -28,7 +28,7 @@
2828
/// max-width: 25vw;
2929
/// }
3030
/// }
31-
@function getFluidSize($breakpointName, $columnSpan) {
31+
@function get-fluid-size($breakpointName, $columnSpan) {
3232
$breakpoint: map-get($breakpointsAndArtboards, $breakpointName);
3333

3434
@if ($breakpoint == null or type-of($breakpoint) != 'map') {
@@ -63,8 +63,8 @@
6363
/// @return {Length} A calculated rem value.
6464
/// @example scss
6565
/// button {
66-
/// @include mediaQuery('sm') {
67-
/// max-width: getFixedSize(10);
66+
/// @include media-query('sm') {
67+
/// max-width: get-fixed-size(10);
6868
/// }
6969
/// }
7070
/// @output css
@@ -73,7 +73,7 @@
7373
/// max-width: 5rem;
7474
/// }
7575
/// }
76-
@function getFixedSize($fixedUnit) {
76+
@function get-fixed-size($fixedUnit) {
7777
$rowHeight: map-get($grid-values, 'rowHeight');
7878

7979
@if ($rowHeight == null or type-of($rowHeight) != 'number') {
@@ -89,8 +89,8 @@
8989

9090
/// Utility for declaring mobile-first media queries.
9191
/// @param {String} $breakpointName The name of the breakpoint to set its width value to media query.
92-
@mixin mediaQuery($breakpointName) {
93-
@media screen and (min-width: #{getBreakpointValue($breakpointName)}) {
92+
@mixin media-query($breakpointName) {
93+
@media screen and (min-width: #{get-breakpoint-value($breakpointName)}) {
9494
@content;
9595
}
9696
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ $prefix: gridish !default;
55
$prefix: map-get($grid-values, "prefix");
66
}
77
$extraBreakpoints: () !default;
8-
$breakpoints: addPadding(map-get($grid-values, "breakpoints"));
8+
$breakpoints: add-padding(map-get($grid-values, "breakpoints"));
99
$first: nth(nth($breakpoints, 1), 2);
1010
$last: nth(nth($breakpoints, -1), 2);
1111
$includeFlexFallback: false !default;
1212
$rowHeight: map-get($grid-values, "rowHeight");
1313
$rows: map-get($grid-values, "rows");
1414
$extraArtboards: map-get($grid-values, "extraArtboards");
15-
$allBreakpoints: allBreakpoints($breakpoints, $extraBreakpoints, $first, $last);
16-
$breakpointsAndArtboards: allBreakpoints($breakpoints, $extraArtboards, $first, $last);
15+
$allBreakpoints: all-breakpoints($breakpoints, $extraBreakpoints, $first, $last);
16+
$breakpointsAndArtboards: all-breakpoints($breakpoints, $extraArtboards, $first, $last);
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)