From a2d346215a6125a2e68784c5597d1fbd02525c23 Mon Sep 17 00:00:00 2001 From: OlgaLarina Date: Thu, 1 Feb 2024 17:41:08 +0300 Subject: [PATCH] refactoring scroll styles (#7788) Co-authored-by: OlgaLarina --- src/defaultV2-theme/blocks/mixins.scss | 36 +++++++- src/defaultV2-theme/defaultV2.fontless.scss | 92 +-------------------- 2 files changed, 38 insertions(+), 90 deletions(-) diff --git a/src/defaultV2-theme/blocks/mixins.scss b/src/defaultV2-theme/blocks/mixins.scss index 2c5b5a4c2f..d8fd18f50d 100644 --- a/src/defaultV2-theme/blocks/mixins.scss +++ b/src/defaultV2-theme/blocks/mixins.scss @@ -50,8 +50,40 @@ padding-inline-start: 0; padding-inline-end: 0; - &+span { + & + span { float: none; width: auto; } -} \ No newline at end of file +} + +@mixin scrollRules { + &, + * { + @-moz-document url-prefix() { + scrollbar-width: thin; + scrollbar-color: $border transparent; + } + + &::-webkit-scrollbar { + width: 12px; + height: 12px; + background-color: transparent; + } + + &::-webkit-scrollbar-thumb { + border: 4px solid rgba(0, 0, 0, 0); + background-clip: padding-box; + border-radius: 32px; + background-color: $border; + } + + &::-webkit-scrollbar-track { + background: transparent; + } + + &::-webkit-scrollbar-thumb:hover { + border: 2px solid rgba(0, 0, 0, 0); + background-color: $foreground-light; + } + } +} diff --git a/src/defaultV2-theme/defaultV2.fontless.scss b/src/defaultV2-theme/defaultV2.fontless.scss index 347dbaeccd..2d883053bb 100644 --- a/src/defaultV2-theme/defaultV2.fontless.scss +++ b/src/defaultV2-theme/defaultV2.fontless.scss @@ -59,6 +59,8 @@ body { } .sd-root-modern { + @include scrollRules; + -webkit-font-smoothing: antialiased; --sd-mobile-width: 600px; --sd-timer-size: calc(18 * #{$base-unit}); @@ -71,33 +73,6 @@ body { // z-index: 1; position: relative; } - - @-moz-document url-prefix() { - scrollbar-width: thin; - scrollbar-color: $border transparent; - } - - ::-webkit-scrollbar { - width: 12px; - height: 12px; - background-color: transparent; - } - - ::-webkit-scrollbar-thumb { - border: 4px solid rgba(0, 0, 0, 0); - background-clip: padding-box; - border-radius: 32px; - background-color: $border; - } - - ::-webkit-scrollbar-track { - background: transparent; - } - - ::-webkit-scrollbar-thumb:hover { - border: 2px solid rgba(0, 0, 0, 0); - background-color: $foreground-light; - } } .sd-root-modern--animation-disabled * { @@ -112,33 +87,6 @@ body { height: 100%; overflow: auto; position: static; - - @-moz-document url-prefix() { - scrollbar-width: thin; - scrollbar-color: $border transparent; - } - - &::-webkit-scrollbar { - width: 12px; - height: 12px; - background-color: transparent; - } - - &::-webkit-scrollbar-thumb { - border: 4px solid rgba(0, 0, 0, 0); - background-clip: padding-box; - border-radius: 32px; - background-color: $border; - } - - &::-webkit-scrollbar-track { - background: transparent; - } - - &::-webkit-scrollbar-thumb:hover { - border: 2px solid rgba(0, 0, 0, 0); - background-color: $foreground-light; - } } .sd-root-modern--mobile { @@ -162,38 +110,6 @@ body { } } -@-moz-document url-prefix() { - .sv-popup .sv-popup__scrolling-content { - scrollbar-width: thin; - scrollbar-color: $border transparent; - } +.sv-popup .sv-popup__scrolling-content { + @include scrollRules; } - -.sv-popup { - .sv-popup__scrolling-content { - *, - & { - &::-webkit-scrollbar { - width: 12px; - height: 12px; - background-color: $background; - } - - &::-webkit-scrollbar-thumb { - border: 4px solid rgba(0, 0, 0, 0); - background-clip: padding-box; - border-radius: 32px; - background-color: $border; - } - - &::-webkit-scrollbar-track { - background: transparent; - } - - &::-webkit-scrollbar-thumb:hover { - border: 2px solid rgba(0, 0, 0, 0); - background-color: $foreground-light; - } - } - } -} \ No newline at end of file