-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(SCSS): expose helper to style webkit scrollbars
- Loading branch information
1 parent
a57ec73
commit 83593c1
Showing
3 changed files
with
109 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
@import './color'; | ||
|
||
|
||
$defaultColor: #{color(pure)}; | ||
|
||
/** | ||
* Styles to make scrollbars always visible on webkit browsers | ||
* | ||
* @param color - The color for the border and background (cannot be transparent) | ||
*/ | ||
@mixin visible-scrollbars($color: $defaultColor) { | ||
$webkit-default-radius: 8px; | ||
$webkit-default-size: 11px; | ||
|
||
&::-webkit-scrollbar { | ||
-webkit-appearance: none; | ||
|
||
&:vertical { | ||
width: $webkit-default-size; | ||
} | ||
|
||
&:horizontal { | ||
height: $webkit-default-size; | ||
} | ||
} | ||
|
||
&::-webkit-scrollbar-thumb { | ||
$webkit-background-color: rgba(0, 0, 0, .5); | ||
background-color: $webkit-background-color; | ||
border: 2px solid $color; | ||
border-radius: $webkit-default-radius; | ||
} | ||
|
||
&::-webkit-scrollbar-track { | ||
background-color: $color; | ||
border-radius: $webkit-default-radius; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
@import 'true'; | ||
@import './scrollbars'; | ||
|
||
|
||
@include describe ('visible-scrollbars') { | ||
@include test ('should correctly render styles') { | ||
@include assert { | ||
@include output { | ||
.test { | ||
@include visible-scrollbars; | ||
} | ||
} | ||
@include expect { | ||
.test::-webkit-scrollbar { | ||
-webkit-appearance: none; | ||
} | ||
|
||
.test::-webkit-scrollbar:vertical { | ||
width: 11px; | ||
} | ||
|
||
.test::-webkit-scrollbar:horizontal { | ||
height: 11px; | ||
} | ||
|
||
.test::-webkit-scrollbar-thumb { | ||
background-color: rgba(0, 0, 0, .5); | ||
border: 2px solid #fafafa; | ||
border-radius: 8px; | ||
} | ||
|
||
.test::-webkit-scrollbar-track { | ||
background-color: #fafafa; | ||
border-radius: 8px; | ||
} | ||
|
||
.test::-webkit-scrollbar-corner { | ||
background-color: #fafafa; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters