-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(theme): refactor scrollbar styles to separate token module and …
…update theme stylesheet to reference new token system only
- Loading branch information
Showing
6 changed files
with
96 additions
and
67 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,40 @@ | ||
@use '../tokens/scrollbar/tokens'; | ||
|
||
/// | ||
/// Provides scrollbar styles. | ||
/// | ||
@mixin base { | ||
&::-webkit-scrollbar { | ||
height: #{tokens.get(height)}; | ||
width: #{tokens.get(width)}; | ||
} | ||
|
||
&::-webkit-scrollbar-track { | ||
background-color: #{tokens.get(track-container)}; | ||
|
||
&:hover { | ||
background-color: #{tokens.get(track-container-hover)}; | ||
} | ||
} | ||
|
||
&::-webkit-scrollbar-corner { | ||
background-color: #{tokens.get(track-container)}; | ||
} | ||
|
||
&::-webkit-scrollbar-thumb { | ||
height: #{tokens.get(thumb-min-height)}; | ||
width: #{tokens.get(thumb-min-width)}; | ||
|
||
border-radius: #{tokens.get(border-radius)}; | ||
border-width: #{tokens.get(border-width)}; | ||
border-style: solid; | ||
border-color: transparent; | ||
|
||
background-color: #{tokens.get(thumb-container)}; | ||
background-clip: content-box; | ||
|
||
&:hover { | ||
background-color: #{tokens.get(thumb-container-hover)}; | ||
} | ||
} | ||
} |
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
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,21 @@ | ||
@use 'sass:map'; | ||
@use '../../theme'; | ||
@use '../../utils'; | ||
@use '../../shape'; | ||
|
||
$tokens: ( | ||
height: utils.module-val(scrollbar, height, 16px), | ||
width: utils.module-val(scrollbar, width, 16px), | ||
thumb-min-height: utils.module-val(scrollbar, thumb-min-height, 32px), | ||
thumb-min-width: utils.module-val(scrollbar, thumb-min-width, 32px), | ||
border-radius: utils.module-val(scrollbar, border-radius, shape.variable(full)), | ||
border-width: utils.module-val(scrollbar, border-width, 3px), | ||
track-container: utils.module-val(scrollbar, track-container, theme.variable(surface-container-low)), | ||
track-container-hover: utils.module-val(scrollbar, track-container-hover, theme.variable(surface-container-low)), | ||
thumb-container: utils.module-val(scrollbar, thumb-container, theme.variable(surface-container-medium)), | ||
thumb-container-hover: utils.module-val(scrollbar, thumb-container-hover, theme.variable(surface-container-high)) | ||
) !default; | ||
|
||
@function get($key) { | ||
@return map.get($tokens, $key); | ||
} |
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
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
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 |
---|---|---|
@@ -1,4 +1,19 @@ | ||
@use './theme'; | ||
@use '../core/styles/theme'; | ||
@use '../core/styles/scrollbar'; | ||
|
||
@include theme.theme-styles; | ||
@include theme.scrollbar-theme-styles; | ||
// Temporary theme properties for compatibility with MDC theme tokens | ||
// | ||
// TODO: remove this once MDC dependency is removed | ||
:root { | ||
@include theme.properties-compat; | ||
} | ||
|
||
// Root theme properties | ||
:root { | ||
@include theme.properties; | ||
} | ||
|
||
// Custom scrollbar styles | ||
* { | ||
@include scrollbar.base; | ||
} |