Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(loading): using new style #1211

Merged
merged 2 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions docs/mobile/api_v2/loading.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,28 @@ isComponent: true
toc: false
---

### 类型
### 组件类型

#### 纯icon
#### 纯图标

{{ base }}

#### icon加文字横向
#### 图标加文字横向

{{ horz }}

#### icon加文字竖向
#### 图标加文字竖向

{{ vert }}

#### 纯文字

{{ pure-text }}

#### 页面进度条加载

{{ bar }}

#### 延迟加载

{{ delay }}
### 组件尺寸

{{ size }}

### 加载速度

{{ speed }}
### 规格

{{ size }}


123 changes: 39 additions & 84 deletions style/mobile/components/loading/_index.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,66 +4,43 @@

@import "../../mixins/_index.less";

.@{prefix}-loading {
.@{loading} {
display: flex;
align-items: center;
position: relative;
color: @loading-color;
font-size: @loading-text-size;
.@{prefix}-icon-loading {
font-size: @loading-icon-size;
}
font-size: @loading-size;

&--inherit-color {
color: inherit;
}

&--vertical {
display: flex;
flex-direction: column;
align-items: center;

.@{prefix}-loading__text {
margin-left: 0;
margin-top: 6px;
margin-top: 8px;
}
}

&__bar {
pointer-events: none;
}

&.@{prefix}-size-s {
font-size: @loading-text-size-small;
.@{prefix}-icon-loading {
font-size: @loading-icon-size-small;
}
}

&.@{prefix}-size-l {
font-size: @loading-text-size-large;
.@{prefix}-icon-loading {
font-size: @loading-icon-size-large;
}
}

&__text {
color: @loading-text-color;
width: auto;
display: inline-block;
vertical-align: middle;
line-height: @loading-text-line-height;
margin-left: @loading-text-margin-left;

&--error {
color: rgba(0, 0, 0, 40%);
}
line-height: 20px;
margin-left: 6px;
font-size: @loading-text-font-size;

&--only {
margin-left: 0;
}
}

&__gradient {
display: inline-flex;
display: flex;
justify-content: center;
align-items: center;
vertical-align: middle;
Expand Down Expand Up @@ -112,41 +89,27 @@
}
}

&__dots {
background-color: @dot-bg-color;
border-radius: @dot-radius;
color: @dot-color;
height: @dot-height;
width: @dotWidth;
position: relative;
left: @dot-left-pos;
box-shadow:
@dot-x1 0 0 0 @dot-before-color,
@dot-x2 0 0 0 @dot-color,
@dot-x3 0 0 0 @dot-after-color;
animation: t-dot-typing 1.5s infinite linear;
}
&__dot {
width: @loading-dot-size;
height: @loading-dot-size;
border-radius: 50%;
background-color: currentColor;
animation-duration: 1.8s;
animation-name: dotting;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-fill-mode: both;

&__bar {
background: @loading-color;
position: fixed;
z-index: 1031;
top: 0;
left: 0;
width: 100%;
height: 2px;
transition: all 200ms ease 0s;
}
&--paused {
animation-play-state: paused;
}

&__shadow {
display: block;
position: absolute;
right: 0;
width: 100px;
height: 100%;
box-shadow: 0 0 10px #29d, 0 0 5px #29d;
opacity: 1;
transform: rotate(3deg) translate(0, -4px);
&s {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 8px;
animation: none;
}
}
}

Expand All @@ -169,32 +132,24 @@
}
}

@keyframes t-dot-typing {
@keyframes dotting {
0% {
box-shadow:
@dot-x1 0 0 0 @dot-color,
@dot-x2 0 0 0 @dot-before-color,
@dot-x3 0 0 0 @dot-after-color;
opacity: .15;
}

1% {
opacity: .8;
}

33.3333% {
box-shadow:
@dot-x1 0 0 0 @dot-before-color,
@dot-x2 0 0 0 @dot-color,
@dot-x3 0 0 0 @dot-after-color;
33% {
opacity: .8;
}

66.6667% {
box-shadow:
@dot-x1 0 0 0 @dot-before-color,
@dot-x2 0 0 0 @dot-after-color,
@dot-x3 0 0 0 @dot-color;
34% {
opacity: .15;
}

100% {
box-shadow:
@dot-x1 0 0 0 @dot-color,
@dot-x2 0 0 0 @dot-before-color,
@dot-x3 0 0 0 @dot-after-color;
opacity: .15;
}
}
44 changes: 8 additions & 36 deletions style/mobile/components/loading/_var.less
Original file line number Diff line number Diff line change
@@ -1,36 +1,8 @@
//颜色
@loading-color: @brand-color-8;

// 字体
@loading-text-line-height: @text-line-height;
@loading-text-color: @text-color-primary;

@loading-text-size: @font-size-base;
@loading-text-size-small: @font-size-s;
@loading-text-size-large: @font-size-l;

// icon
@loading-icon-size: 28px;
@loading-icon-size-small: 24px;
@loading-icon-size-large: 32px;

// 间距
@loading-text-margin-left: 5px;

// dots
@dotWidth: 8px;
@dot-height: 8px;
@dot-radius: calc(@dotWidth / 2);

@dot-color: @brand-color-8;
@dot-bg-color: @dot-color;
@dot-before-color: rgba(@brand-color-8, .15);
@dot-after-color: rgba(@brand-color-8, .15);

@dot-spacing: calc(@dotWidth * 2);

@dot-left-pos: -9999px;

@dot-x1: calc(0px - @dot-left-pos - @dot-spacing);
@dot-x2: -@dot-left-pos;
@dot-x3: calc(0px - @dot-left-pos + @dot-spacing);
@loading: ~"@{prefix}-loading";

@loading-color: var(--td-loading-color, @brand-color);
@loading-size: var(--td-loading-size, 20px);
@loading-text-color: var(--td-loading-text-color, @text-color-primary);
@loading-text-font-size: var(--td-loading-text-font-size, 12px);
@loading-text-line-height: var(--td-loading-text-line-height, 20px);
@loading-dot-size: var(--td-loading-dot-size, 8px);