New Spin design

This commit is contained in:
afc163 2016-06-18 15:43:42 +08:00
parent 7c34766ad0
commit 14edd75486
3 changed files with 37 additions and 35 deletions

View File

@ -11,10 +11,14 @@ import { Spin } from 'antd';
ReactDOM.render( ReactDOM.render(
<div> <div>
<Spin size="small" /> <Spin size="small" />
<br />
<Spin /> <Spin />
<br />
<Spin size="large" /> <Spin size="large" />
</div> </div>
, mountNode); , mountNode);
```` ````
<style>
.ant-spin {
margin-right: 16px;
}
</style>

View File

@ -77,9 +77,7 @@ export default class Spin extends React.Component {
const spinElement = ( const spinElement = (
<div {...restProps} className={spinClassName}> <div {...restProps} className={spinClassName}>
<span className={`${prefixCls}-dot ${prefixCls}-dot-first`} /> <span className={`${prefixCls}-dot`} />
<span className={`${prefixCls}-dot ${prefixCls}-dot-second`} />
<span className={`${prefixCls}-dot ${prefixCls}-dot-third`} />
<div className={`${prefixCls}-text`}>{tip || '加载中...'}</div> <div className={`${prefixCls}-text`}>{tip || '加载中...'}</div>
</div> </div>
); );

View File

@ -3,9 +3,9 @@
@spin-prefix-cls: ant-spin; @spin-prefix-cls: ant-spin;
@spin-dot-default: #999; @spin-dot-default: #999;
@spin-dot-size: 8px; @spin-dot-size-sm: 12px;
@spin-dot-size-sm: @spin-dot-size / 2; @spin-dot-size: 20px;
@spin-dot-size-lg: @spin-dot-size * 2; @spin-dot-size-lg: 32px;
.@{spin-prefix-cls} { .@{spin-prefix-cls} {
color: @primary-color; color: @primary-color;
@ -15,7 +15,7 @@
opacity: 0; opacity: 0;
position: absolute; position: absolute;
visibility: hidden; visibility: hidden;
transition: opacity 0.3s @ease-in-out-circ; transition: transform 0.3s @ease-in-out-circ;
font-size: @font-size-base; font-size: @font-size-base;
&-spinning { &-spinning {
@ -37,6 +37,9 @@
z-index: 4; z-index: 4;
text-align: center; text-align: center;
width: 100%; width: 100%;
&-dot {
display: inline-block;
}
} }
&-container { &-container {
@ -70,21 +73,26 @@
// ------------------------------ // ------------------------------
&-dot { &-dot {
animation: antSpinPulse 1.2s infinite @ease-in-out-circ; position: relative;
display: block;
.square(@spin-dot-size); .square(@spin-dot-size);
border-radius: 50%; &:before,
display: inline-block; &:after {
background-color: @primary-color; content: '';
} border-radius: 50%;
&-dot-second { background-color: @primary-color;
animation-delay: .2s; animation: antSpinBounce 2.2s infinite ease-in-out;
} display: block;
&-dot-third { position: absolute;
animation-delay: .4s; opacity: 0.5;
} top: 0;
left: 0;
&-dot + &-dot { bottom: 0;
margin-left: @spin-dot-size; right: 0;
}
&:after {
animation-delay: -1.1s;
}
} }
// Sizes // Sizes
@ -92,17 +100,11 @@
// small // small
&-sm &-dot { &-sm &-dot {
.square(@spin-dot-size-sm); .square(@spin-dot-size-sm);
+ & {
margin-left: @spin-dot-size-sm;
}
} }
// large // large
&-lg &-dot { &-lg &-dot {
.square(@spin-dot-size-lg); .square(@spin-dot-size-lg);
+ & {
margin-left: @spin-dot-size-lg;
}
} }
&-text, &-text,
@ -115,15 +117,13 @@
} }
} }
// pulse @keyframes antSpinBounce {
@keyframes antSpinPulse {
0%, 0%,
80%,
100% { 100% {
opacity: 0; transform: scale(0);
} }
40% { 50% {
opacity: 1; transform: scale(1);
} }
} }