Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base Styles: Extract long-content-fade to its own file so it can be imported and reused. #46485

Merged
merged 3 commits into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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