Skip to content

Commit

Permalink
Base Styles: Extract long-content-fade to its own file so it can be i…
Browse files Browse the repository at this point in the history
…mported and reused. (#46485)

Co-authored-by: Daniel Bachhuber <daniel.bachhuber@automattic.com>
  • Loading branch information
vykes-mac and danielbachhuber authored Dec 21, 2022
1 parent cbacc8d commit efab914
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 63 deletions.
61 changes: 61 additions & 0 deletions packages/base-styles/_long-content-fade.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/**
* Long content fade mixin
*
* Creates a fading overlay to signify that the content is longer
* than the space allows.
*/

@mixin long-content-fade($direction: right, $size: 20%, $color: #fff, $edge: 0, $z-index: false) {
content: "";
display: block;
position: absolute;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
pointer-events: none;

@if $z-index {
z-index: $z-index;
}

@if $direction == "bottom" {
background: linear-gradient(to top, transparent, $color 90%);
left: $edge;
right: $edge;
top: $edge;
bottom: calc(100% - $size);
width: auto;
}

@if $direction == "top" {
background: linear-gradient(to bottom, transparent, $color 90%);
top: calc(100% - $size);
left: $edge;
right: $edge;
bottom: $edge;
width: auto;
}

@if $direction == "left" {
background: linear-gradient(to left, transparent, $color 90%);
top: $edge;
left: $edge;
bottom: $edge;
right: auto;
width: $size;
height: auto;
}

@if $direction == "right" {
background: linear-gradient(to right, transparent, $color 90%);
top: $edge;
bottom: $edge;
right: $edge;
left: auto;
width: $size;
height: auto;
}
}
64 changes: 1 addition & 63 deletions packages/base-styles/_mixins.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import "./functions";
@import "./long-content-fade";

/**
* Breakpoint mixins
Expand Down Expand Up @@ -52,69 +53,6 @@
}
}


/**
* Long content fade mixin
*
* Creates a fading overlay to signify that the content is longer
* than the space allows.
*/

@mixin long-content-fade($direction: right, $size: 20%, $color: #fff, $edge: 0, $z-index: false) {
content: "";
display: block;
position: absolute;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
pointer-events: none;

@if $z-index {
z-index: $z-index;
}

@if $direction == "bottom" {
background: linear-gradient(to top, transparent, $color 90%);
left: $edge;
right: $edge;
top: $edge;
bottom: calc(100% - $size);
width: auto;
}

@if $direction == "top" {
background: linear-gradient(to bottom, transparent, $color 90%);
top: calc(100% - $size);
left: $edge;
right: $edge;
bottom: $edge;
width: auto;
}

@if $direction == "left" {
background: linear-gradient(to left, transparent, $color 90%);
top: $edge;
left: $edge;
bottom: $edge;
right: auto;
width: $size;
height: auto;
}

@if $direction == "right" {
background: linear-gradient(to right, transparent, $color 90%);
top: $edge;
bottom: $edge;
right: $edge;
left: auto;
width: $size;
height: auto;
}
}

/**
* Focus styles.
*/
Expand Down

1 comment on commit efab914

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3750826649
📝 Reported issues:

Please sign in to comment.