Skip to content

Commit

Permalink
feat(components): 新增css变量和scss变量
Browse files Browse the repository at this point in the history
  • Loading branch information
mengxinssfd committed Jun 4, 2023
1 parent bdafeec commit 3afde90
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
13 changes: 13 additions & 0 deletions packages/components/src/css.variable.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
:root {
--t-redis: 10px;
--t-transition-duration: 0.3s;
--t-mask-bg-color: rgba(255, 255, 255, 0.38);
--t-text-color: black;
--t-text-reverse-color: white;
&.dark {

--t-mask-bg-color: rgba(0, 0, 0, 0.38);
--t-text-color: white;
--t-text-reverse-color: black;
}
}
1 change: 1 addition & 0 deletions packages/components/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './css.variable.scss';
export * from './transition';
export * from './transition-group';
export * from './loading';
10 changes: 6 additions & 4 deletions packages/components/src/loading/Loading.module.scss
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
@import '../scss.variable';

.ref {
position: relative;
}

:global {
.t-loading {
.#{$PREFIX}loading {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
color: white;
backdrop-filter: blur(2px);
.loading-box {
position: absolute;
top: 50%;
Expand Down Expand Up @@ -38,7 +40,7 @@
}
}
}
body > .t-loading {
body > .#{$PREFIX}loading {
position: fixed;
}

Expand All @@ -49,7 +51,7 @@

.loading-enter-active,
.loading-leave-active {
transition: opacity 0.3s ease-in-out;
transition: opacity var(--t-transition-duration) ease-in-out;
}

@keyframes :global(loading-rotate) {
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/loading/Loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ export const Loading: React.FC<LoadingOptions> = memo((props) => {

Loading.defaultProps = {
className: '',
background: 'rgba(0, 0, 0, 0.38)',
background: 'var(--t-mask-bg-color)',
color: 'var(--t-text-color)',
mode: 'insert',
zIndex: 100,
text: 'loading...',
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/scss.variable.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$PREFIX: 't-'

0 comments on commit 3afde90

Please sign in to comment.