Skip to content

Commit

Permalink
Merge pull request #159 from BeAPI/feature/abstract-gutenberg-align
Browse files Browse the repository at this point in the history
feat (Abstract scss) : add function align for gutenberg block
  • Loading branch information
n-langle committed Apr 23, 2021
2 parents 1e6161b + 476c717 commit c953b3f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/scss/abstract/_f-context-align.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Align
*
* exemples :
*
* #{ context-align("wide") } .block#{ context-align() } {
* ... your css
* }
*
* return for style.scss :
* .block.alignwide {
* ... your css
* }
*
* return for editor-style.scss :
* [data-align="wide"] > .block {
* ... your css
* }
*
*/

$function-context-align-last-value: "";

@function context-align($value: null, $suffix: " > ") {
@if ($value == null) {
@if ($entry-file-name == "style") {
@return ".align" + $function-context-align-last-value;
}
} @else {
$function-context-align-last-value: $value !global;

@if ($entry-file-name == "editor-style") {
@return "[data-align=\"" + $value + "\"]" + $suffix;
}
}

@return "";
}
1 change: 1 addition & 0 deletions src/scss/abstract/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

@import "./f-assign-inputs";
@import "./f-column";
@import "./f-context-align";
@import "./f-context-selector";
@import "./f-easings";
@import "./f-em";
Expand Down

0 comments on commit c953b3f

Please sign in to comment.