Skip to content

Commit

Permalink
Merge pull request #16 from Handpear/main
Browse files Browse the repository at this point in the history
修复切换 skin 后样式名称不正确的问题
  • Loading branch information
MinJieLiu authored Jul 13, 2022
2 parents f8eaade + 5d48b4b commit 4198eba
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/mac-scrollbar/src/GlobalScrollbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ export interface GlobalScrollbarProps extends GlobalScrollbarBase {
trackGap?: number;
}

function GlobalScrollbarInject({ skin = 'white', ...props }: GlobalScrollbarProps) {
function GlobalScrollbarInject({ skin = 'light', ...props }: GlobalScrollbarProps) {
const wrapper = useInitial(() => document.createElement('div'));

useEffect(() => {
wrapper.classList.add('ms-track-global', `ms-theme-${skin}`);
wrapper.classList.remove(`ms-theme-${skin === 'light' ? 'dark' : 'light'}`);
const wrapperCls = 'ms-container';
const docClassList = document.documentElement.classList;

Expand Down
2 changes: 1 addition & 1 deletion packages/mac-scrollbar/src/Scrollbar.less
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}
}

.ms-theme-white {
.ms-theme-light {
--ms-track-background: rgba(248, 248, 248, 0.76);
--ms-track-border-color: #dfdfdf;
--ms-thumb-color: rgba(0, 0, 0, 0.5);
Expand Down
2 changes: 1 addition & 1 deletion packages/mac-scrollbar/src/Scrollbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function ScrollBar({
suppressScrollX,
suppressScrollY,
suppressAutoHide,
skin = 'white',
skin = 'light',
trackGap,
trackStyle,
thumbStyle,
Expand Down
4 changes: 2 additions & 2 deletions packages/mac-scrollbar/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ export interface ActionPosition {
export interface GlobalScrollbarBase {
/**
* Adapt to the background color of the container.
* @defaultValue 'white'
* @defaultValue 'light'
*/
skin?: 'white' | 'dark';
skin?: 'light' | 'dark';
/**
* Track style.
*/
Expand Down

0 comments on commit 4198eba

Please sign in to comment.