Skip to content

Commit

Permalink
feat(comp:style): add min scroll and css variable support (#1564)
Browse files Browse the repository at this point in the history
  • Loading branch information
danranVm committed May 26, 2023
1 parent 15be909 commit d425a6f
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 25 deletions.
33 changes: 22 additions & 11 deletions packages/components/style/mixins/reset.less
Expand Up @@ -28,30 +28,41 @@

.reset-scroll() {
::-webkit-scrollbar {
width: @scrollbar-width;
height: @scrollbar-height;
width: var(--ix-scrollbar-width);
height: var(--ix-scrollbar-height);
}

::-webkit-scrollbar-thumb {
background-clip: padding-box;
background-color: @scrollbar-thumb-background-color;
border: @scrollbar-thumb-border solid transparent;
border-radius: @scrollbar-thumb-border-radius;
box-shadow: @scrollbar-thumb-box-shadow;
background-color: var(--ix-scrollbar-thumb-background-color);
border: var(--ix-scrollbar-thumb-border-width) solid transparent;
border-radius: var(--ix-scrollbar-thumb-border-radius);
box-shadow: var(--ix-scrollbar-thumb-box-shadow);

&:hover {
background-color: @scrollbar-thumb-hover-background-color;
background-color: var(--ix-scrollbar-thumb-background-color-hover);
}

&:active {
background-color: @scrollbar-thumb-active-background-color;
background-color: var(--ix-scrollbar-thumb-background-color-active);
}
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
background-color: @scrollbar-track-background-color;
border-radius: @scrollbar-track-border-radius;
box-shadow: @scrollbar-track-box-shadow;
background-color: var(--ix-scrollbar-track-background-color);
border-radius: var(--ix-scrollbar-track-border-radius);
box-shadow: var(--ix-scrollbar-track-box-shadow);
}

.@{idux-prefix}-scroll-min {
::-webkit-scrollbar-thumb {
border-width: calc(var(--ix-scrollbar-thumb-border-width) * 2);

&:hover,
&:active {
border-width: var(--ix-scrollbar-thumb-border-width);
}
}
}
}
14 changes: 14 additions & 0 deletions packages/components/style/themes/default.less
Expand Up @@ -94,6 +94,19 @@
--ix-spacing-xl: 24px;
--ix-spacing-2xl: 32px;

// scroll
--ix-scrollbar-width: 8px;
--ix-scrollbar-height: 8px;
--ix-scrollbar-thumb-background-color: @color-grey-l30;
--ix-scrollbar-thumb-background-color-hover: @color-grey-l10;
--ix-scrollbar-thumb-background-color-active: @color-grey-d10;
--ix-scrollbar-thumb-border-width: 0;
--ix-scrollbar-thumb-border-radius: 4px;
--ix-scrollbar-thumb-box-shadow: none;
--ix-scrollbar-track-background-color: unset;
--ix-scrollbar-track-border-radius: 0;
--ix-scrollbar-track-box-shadow: unset;

// Motion
--ix-transition-duration-fast: 0.18s;
--ix-transition-duration-medium: 0.24s;
Expand Down Expand Up @@ -126,6 +139,7 @@
@border-color-inverse: @color-white;
@border-color-split: @color-grey-l30;

// 临时兼容,后面需要移除
// Scrollbar
@scrollbar-width: 8px;
@scrollbar-height: 8px;
Expand Down
10 changes: 10 additions & 0 deletions packages/components/style/themes/seer.less
Expand Up @@ -24,6 +24,15 @@

// Font-Size
--ix-font-size: 12px;

// Scrollbar
--ix-scrollbar-width: 12px;
--ix-scrollbar-height: 12px;
--ix-scrollbar-thumb-background-color: @color-graphite-l30;
--ix-scrollbar-thumb-background-color-hover: @color-graphite-l10;
--ix-scrollbar-thumb-background-color-active: @color-graphite-l10;
--ix-scrollbar-thumb-border-width: 2px;
--ix-scrollbar-thumb-border-radius: 6px;
}

// 临时兼容,后面需要移除
Expand All @@ -39,6 +48,7 @@
@border-color: @color-graphite-l20;
@border-color-split: @color-graphite-l30;

// 临时兼容,后面需要移除
// Scrollbar
@scrollbar-width: 12px;
@scrollbar-height: 12px;
Expand Down
20 changes: 10 additions & 10 deletions packages/components/table/style/index.less
Expand Up @@ -334,28 +334,28 @@
position: sticky;
bottom: 0;
z-index: 3;
background-color: @scrollbar-track-background-color;
border-radius: @scrollbar-track-border-radius;
box-shadow: @scrollbar-track-box-shadow;
background-color: var(--ix-scrollbar-track-background-color);
border-radius: var(--ix-scrollbar-track-border-radius);
box-shadow: var(--ix-scrollbar-track-box-shadow);

&:hover {
transform-origin: center bottom;
}

&-thumb {
height: @scrollbar-height;
height: var(--ix-scrollbar-height);
background-clip: padding-box;
background-color: @scrollbar-thumb-background-color;
border: @scrollbar-thumb-border solid transparent;
border-radius: @scrollbar-thumb-border-radius;
box-shadow: @scrollbar-thumb-box-shadow;
background-color: var(--ix-scrollbar-thumb-background-color);
border: var(--ix-scrollbar-thumb-border-width) solid transparent;
border-radius: var(--ix-scrollbar-thumb-border-radius);
box-shadow: var(--ix-scrollbar-thumb-box-shadow);

&:hover {
background-color: @scrollbar-thumb-hover-background-color;
background-color: var(--ix-scrollbar-thumb-background-color-hover);
}

&&-active {
background-color: @scrollbar-thumb-active-background-color;
background-color: var(--ix-scrollbar-thumb-background-color-active);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/pro/search/src/ProSearch.tsx
Expand Up @@ -217,7 +217,7 @@ export default defineComponent({

const quickSelectOverlayProps = {
...commonOverlayProps.value,
class: `${mergedPrefixCls.value}-quick-select-overlay`,
class: `${mergedPrefixCls.value}-quick-select-overlay ${componentCommon.prefixCls}-scroll-min`,
style: {
width: convertCssPixel(elementWidth.value),
},
Expand Down
6 changes: 3 additions & 3 deletions packages/pro/search/style/quick-select.less
Expand Up @@ -3,7 +3,7 @@

.@{pro-search-prefix}-quick-select {
&-overlay {
.overlay()
.overlay();
}

&-panel {
Expand Down Expand Up @@ -69,7 +69,7 @@
height: 100%;
max-width: calc(100% - 24px);
color: @color-graphite;
.ellipsis()
.ellipsis();
}
&-search-bar {
position: absolute;
Expand Down Expand Up @@ -136,4 +136,4 @@
}
}
}
}
}

0 comments on commit d425a6f

Please sign in to comment.