Skip to content

Commit 9a5084a

Browse files
committed
Functions and Mixin documentation first part
1 parent 0d89dd5 commit 9a5084a

32 files changed

+481
-140
lines changed

src/scss/02-tools/_f-assign-inputs.scss

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,28 @@
22
@use "sass:string";
33

44
/**
5-
* Assign inputs
5+
* Assign inputs - Make a variable selector with multiple inputs
6+
*
7+
* @author Nicolas Langle
8+
*
9+
* @param $inputs
10+
* @param $pseudo
11+
*
12+
* Examples :
13+
* $text-inputs-list: 'input[type="color"]', 'input[type="date"]',
14+
* 'input[type="datetime"]', 'input[type="datetime-local"]',
15+
* 'input[type="email"]', 'input[type="month"]', 'input[type="number"]',
16+
* 'input[type="password"]', 'input[type="search"]', 'input[type="tel"]',
17+
* 'input[type="text"]', 'input[type="time"]', 'input[type="url"]',
18+
* 'input[type="week"]', "input:not([type])", "textarea";
19+
*
20+
* $all-text-inputs: assign-inputs($text-inputs-list);
21+
*
22+
* And use as a selector :
23+
* #{(dollar)all-text-inputs} {
24+
* ...
25+
* }
26+
*
627
*/
728

829
@function assign-inputs($inputs, $pseudo: null) {

src/scss/02-tools/_f-column.scss

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,48 @@
22
@use "sass:math";
33

44
/**
5-
* Column
5+
* 1/ Column - Make a column that return a percent value
66
*
7-
* examples :
7+
* @author Nicolas Langle
8+
*
9+
* @param $device (based on $column-preset variable)
10+
* @param $nb-column
11+
* @param $nb-gutter
12+
* @param $total-column
13+
* @param $total-gutter
14+
*
15+
* Examples :
816
* column(6) -> return 6 column + 5 gutter of desktop preset
9-
* column('m', 6) -> return 6 column + 5 gutter of mobile preset
10-
* column(6, 5, 8) -> return 6 column + 5 gutter of 8 grid size of desktop
17+
* column('m', 6) -> return 6 column + 5 gutter of mobile preset
18+
* column(6, 5, 8) -> return 6 column + 5 gutter of 8 grid size of desktop
19+
*
20+
* ------------------------------------------------------------------------------------
21+
*
22+
* 2/ Column px - Make a column that return a pixel value
23+
*
24+
* @author Nicolas Langle
25+
*
26+
* @param $device (based on $column-preset variable)
27+
* @param $nb-column
28+
* @param $nb-gutter
29+
* @param $unitless
30+
*
31+
* Examples :
32+
* column(6) -> return 6 column + 5 gutter of desktop preset with px unit
33+
* column(6, true) -> return 6 column + 5 gutter of desktop preset without px unit
34+
*
35+
* ------------------------------------------------------------------------------------
36+
*
37+
* 2/ Column full - Make a column that return a percent value of the full width container (100%) minus mobile external gutter width * 2
38+
*
39+
* @author Nicolas Langle
40+
*
41+
* @param $device (based on $column-preset variable)
42+
* @param $nb-column
43+
* @param $nb-gutter
44+
*
45+
* Examples :
46+
* column(6) -> return 6 column + 5 gutter of desktop preset
1147
*
1248
*/
1349

src/scss/02-tools/_f-context-align.scss

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
/**
2-
* Align
2+
* Align - Make a context align (editor / style)
33
*
4-
* examples :
4+
* @author Nicolas Langle
55
*
6+
* @param $value
7+
* @param $suffix
8+
*
9+
* Examples :
610
* #{ context-align("wide") } .block#{ context-align() } {
711
* ... your css
812
* }
913
*
10-
* return for style.scss :
11-
* .block.alignwide {
12-
* ... your css
13-
* }
14+
* return for style.scss :
15+
* .block.alignwide {
16+
* ... your css
17+
* }
1418
*
1519
* return for editor.scss :
16-
* [data-align="wide"] > .block {
17-
* ... your css
18-
* }
20+
* [data-align="wide"] > .block {
21+
* ... your css
22+
* }
1923
*
2024
*/
2125

src/scss/02-tools/_f-context-selector.scss

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,52 @@
11
/**
2-
* Context selector
2+
* Context selector - Make a context selector (editor / style)
33
*
4-
* examples :
4+
* @author Milan Ricoul
55
*
6+
* @param $default
7+
* @param $editor
8+
* @param $selector
9+
*
10+
* Examples :
611
* #{ context-selector('#main__content', '#editor', '.block') } {
712
* ... your css
813
* }
914
*
1015
* return for style.scss :
11-
* #main__content .block {
12-
* ... your css
13-
* }
16+
* #main__content .block {
17+
* ... your css
18+
* }
1419
*
1520
* return for editor.scss :
16-
* #editor .block {
17-
* ... your css
18-
* }
21+
* #editor .block {
22+
* ... your css
23+
* }
1924
*
2025
* $selectors: ".blocks-gallery-image,", ".blocks-gallery-item";
2126
* #{ context-selector('.wp-block-gallery', '.blocks-gallery-grid', selectors) } {
2227
* ... your css
2328
* }
2429
*
2530
* return for style.scss :
26-
* .wp-block-gallery .blocks-gallery-image,
27-
* .wp-block-gallery .blocks-gallery-item {
28-
* ... your css
29-
* }
31+
* .wp-block-gallery .blocks-gallery-image,
32+
* .wp-block-gallery .blocks-gallery-item {
33+
* ... your css
34+
* }
3035
*
3136
* return for editor.scss :
32-
* .blocks-gallery-grid .blocks-gallery-image,
33-
* .blocks-gallery-grid .blocks-gallery-item {
34-
* ... your css
35-
* }
37+
* .blocks-gallery-grid .blocks-gallery-image,
38+
* .blocks-gallery-grid .blocks-gallery-item {
39+
* ... your css
40+
* }
3641
*
3742
* It can be used to define a variable :
38-
*
3943
* $parent: context-selector('#main__content', '#editor')
40-
*
4144
* #{(dollar)parent} > .block {
4245
* ... your css
4346
* }
4447
*
4548
* the variable $entry-file-name is defined in style.scss and editor.scss
49+
*
4650
*/
4751

4852
@function context-selector($default: null, $editor: null, $selector: null) {

src/scss/02-tools/_f-easings.scss

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
@use "sass:math";
22

33
/**
4-
* Easings
4+
* Easings - for CSS animations
55
*
6-
* converted from source: https://github.com/ai/easings.net/blob/master/src/easings/easingsFunctions.ts
7-
* each ease receive a value $x in a range of 0 to 1
6+
* @author Nicolas Langle
87
*
9-
* examples :
8+
* @param $value
9+
* @param $suffix
10+
*
11+
* converted from source: https://github.com/ai/easings.net/blob/master/src/easings/easingsFunctions.ts
12+
* each ease receive a value $x in a range of 0 to 1
13+
*
14+
* Examples :
1015
*
1116
* @for (dollar)i from 0 through 10 {
1217
* .test {
@@ -55,6 +60,7 @@
5560
* ease-in-out-bounce
5661
*
5762
*/
63+
5864
$easings-const-c1: 1.70158;
5965
$easings-const-c2: $easings-const-c1 * 1.525;
6066
$easings-const-c3: $easings-const-c1 + 1;

src/scss/02-tools/_f-em.scss

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
@use "sass:math";
22

33
/**
4-
* Em
4+
* Em - Convert value from px to em
5+
*
6+
* Source : https://github.com/thoughtbot/carnival/blob/master/sass/bourbon/functions/_px-to-em.scss
7+
*
8+
* @author Nicolas Langle
9+
*
10+
* @param $pxval
11+
* @param $base
12+
*
13+
* Examples :
14+
*
15+
* $font-size: 16px; // don't use em function whitout param
16+
*
17+
* .test {
18+
* font-size: em(112px, $font-size);
19+
* }
520
*
6-
* convert value from px to em
721
*/
822

923
@function em($pxval, $base: $font-size-base) {

src/scss/02-tools/_f-get-gutter-width.scss

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
@use "sass:map";
22

33
/**
4-
* Get Gutter width
4+
* Get Gutter width - Get the value of gutter according to the preset
5+
*
6+
* @author Milan Ricoul
7+
*
8+
* @param $preset (based on $column-preset variable)
9+
*
10+
* Examples :
11+
*
12+
* .test {
13+
* display: grid;
14+
* grid-template-column: repeat(3, 1fr);
15+
* gap: get-gutter-width(); // return gutter width desktop preset
16+
* }
17+
*
18+
* .test {
19+
* display: grid;
20+
* grid-template-column: repeat(3, 1fr);
21+
* gap: get-gutter-width('m'); // return gutter width mobile preset
22+
* }
523
*
6-
* get the value of gutter according to the preset
724
*/
825

926
@function get-gutter($preset: d) {

src/scss/02-tools/_f-get-svg-url.scss

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,32 @@
11
@use "sass:map";
22

33
/**
4-
* get-svg-url
4+
* Get svg url - Display a svg in background image
55
*
6-
* examples :
7-
* get-svg-url("arrow")
8-
* get-svg-url("arrow", $color-primary)
6+
* @author Nicolas Langle
7+
*
8+
* @param $name
9+
* @param $fill
10+
* @param $opacity
11+
* @param $style
12+
*
13+
* Examples :
14+
*
15+
* .my-icon {
16+
* background-image: get-svg-url("arrow", $color-primary);
17+
* background-repeat: no-repeat;
18+
* background-position: center;
19+
* background-size: 20px;
20+
* }
21+
*
22+
* // With css mask (for icon with current color)
23+
* .my-icon {
24+
* width; 20px;
25+
* height: 20px;
26+
* background-color: currentColor;
27+
* -webkit-mask-image: get-svg-url("arrow", "");
28+
* mask-image: get-svg-url("arrow", "");
29+
* }
930
*
1031
*/
1132

src/scss/02-tools/_f-strip-units.scss

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
@use "sass:math";
22

33
/**
4-
* Strip units
4+
* Strip units - Remove unit
5+
*
6+
* @author Nicolas Langle
7+
*
8+
* @param $value
9+
*
10+
* Examples :
11+
*
12+
* strip-units(10px) -> return 10
13+
* strip-units(10%) -> return 10
14+
* strip-units(10) -> return 10
15+
*
516
*/
617

718
@function strip-units($value) {

src/scss/02-tools/_f-to-number.scss

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)