Skip to content

Commit c953b3f

Browse files
authored
Merge pull request #159 from BeAPI/feature/abstract-gutenberg-align
feat (Abstract scss) : add function align for gutenberg block
2 parents 1e6161b + 476c717 commit c953b3f

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* Align
3+
*
4+
* exemples :
5+
*
6+
* #{ context-align("wide") } .block#{ context-align() } {
7+
* ... your css
8+
* }
9+
*
10+
* return for style.scss :
11+
* .block.alignwide {
12+
* ... your css
13+
* }
14+
*
15+
* return for editor-style.scss :
16+
* [data-align="wide"] > .block {
17+
* ... your css
18+
* }
19+
*
20+
*/
21+
22+
$function-context-align-last-value: "";
23+
24+
@function context-align($value: null, $suffix: " > ") {
25+
@if ($value == null) {
26+
@if ($entry-file-name == "style") {
27+
@return ".align" + $function-context-align-last-value;
28+
}
29+
} @else {
30+
$function-context-align-last-value: $value !global;
31+
32+
@if ($entry-file-name == "editor-style") {
33+
@return "[data-align=\"" + $value + "\"]" + $suffix;
34+
}
35+
}
36+
37+
@return "";
38+
}

src/scss/abstract/_index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
@import "./f-assign-inputs";
1010
@import "./f-column";
11+
@import "./f-context-align";
1112
@import "./f-context-selector";
1213
@import "./f-easings";
1314
@import "./f-em";

0 commit comments

Comments
 (0)