Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
feat: 完成demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Summer-andy committed Nov 8, 2019
1 parent 586aa83 commit 3cd3aa5
Show file tree
Hide file tree
Showing 17 changed files with 354 additions and 78 deletions.
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
registry=https://registry.npm.taobao.org/
registry=https://registry.npmjs.org/
1 change: 0 additions & 1 deletion react-loading/README.md

This file was deleted.

2 changes: 2 additions & 0 deletions src/components/BlockLoading/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import React from 'react';
import './index.scss';
const BlockLoading = () => {
return (
<div className="load-container-block">
<div className="load-block">
<div className="item1"></div>
<div className="item2"></div>
<div className="item4"></div>
<div className="item3"></div>
</div>
</div>
);
};

Expand Down
131 changes: 69 additions & 62 deletions src/components/BlockLoading/index.scss
Original file line number Diff line number Diff line change
@@ -1,126 +1,133 @@
$color: #c2f5d3;
$color: #00adb5;
$inColor: #f9c094;

.load-block {
width: 45px;
height: 45px;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
align-items: center;
animation: rotate 8s infinite ease-in-out;
.item1 {
width: 20px;
height: 20px;
animation: changeColor1 2s infinite ease-in-out;
}
.item2 {
width: 20px;
height: 20px;
animation: changeColor2 2s infinite ease-in-out;
}
.item3 {
width: 20px;
height: 20px;
animation: changeColor3 2s infinite ease-in-out;
}
.item4 {
width: 20px;
height: 20px;
animation: changeColor4 2s infinite ease-in-out;
.load-container-block {
position: relative;
width: 150px;
height: 150px;
margin: 0 auto;
.load-block {
margin: auto;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: 45px;
height: 45px;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
align-items: center;
animation: rotate 8s infinite ease-in-out;
.item1 {
width: 20px;
height: 20px;
animation: changeColor1 2s infinite ease-in-out;
}
.item2 {
width: 20px;
height: 20px;
animation: changeColor2 2s infinite ease-in-out;
}
.item3 {
width: 20px;
height: 20px;
animation: changeColor3 2s infinite ease-in-out;
}
.item4 {
width: 20px;
height: 20px;
animation: changeColor4 2s infinite ease-in-out;
}
}
}

@keyframes rotate {
0% {
transform:rotate(0deg);
transform: rotate(0deg);
}
25% {
transform:rotate(90deg);
transform: rotate(90deg);
}
50% {
transform:rotate(180deg);
transform: rotate(180deg);
}
75% {
transform:rotate(270deg);
transform: rotate(270deg);
}
100% {
transform:rotate(360deg);
transform: rotate(360deg);
}
}


@keyframes changeColor1{
@keyframes changeColor1 {
0% {
background:$inColor;
background: $inColor;
}
25% {
background:$color
background: $color;
}
50% {
background:$color
background: $color;
}
75% {
background:$color
background: $color;
}
100% {
background:$inColor;
background: $inColor;
}
}


@keyframes changeColor2{
@keyframes changeColor2 {
0% {
background:$color
background: $color;
}
25% {
background:$inColor;
background: $inColor;
}
50% {
background:$color
background: $color;
}
75% {
background:$color
background: $color;
}
100% {
background:$color
background: $color;
}
}


@keyframes changeColor3{
@keyframes changeColor3 {
0% {
background:$color
background: $color;
}
25% {
background:$color
background: $color;
}
50% {
background:$inColor;
background: $inColor;
}
75% {
background:$color
background: $color;
}
100% {
background:$color
background: $color;
}
}


@keyframes changeColor4{
@keyframes changeColor4 {
0% {
background:$color
background: $color;
}
25% {
background:$color
background: $color;
}
50% {
background:$color
background: $color;
}
75% {
background:$inColor;
background: $inColor;
}
100% {
background:$color
background: $color;
}
}
4 changes: 3 additions & 1 deletion src/components/CircleLoading/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import React from 'react';
import './index.scss';
const CircleLoading = () => {
return (
<div className="load"></div>
<div className="load-container-block">
<div className="load"></div>
</div>
);
};

Expand Down
10 changes: 7 additions & 3 deletions src/components/CircleLoading/index.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
.load {
margin: auto;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: 50px;
height: 50px;
margin: 0 auto;
position: relative;
border-radius: 50%;
overflow: hidden;
background-color: rgba(0, 169, 178,.2);;
background-color: rgba(0, 169, 178,.2);
&::before {
content: "";
width: 70px; // 50 * √2
Expand Down
10 changes: 6 additions & 4 deletions src/components/CommonLoading/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React from 'react';
import './index.scss';
import './index.scss';
const CommonLoading = ({ style }) => {
return (
<svg id="load" x="0px" y="0px" viewBox="0 0 150 150" style={style}>
<circle id="loading-inner" cx="75" cy="75" r="60"/>
</svg>
<div className="load-container-block">
<svg id="load" x="0px" y="0px" viewBox="0 0 150 150" style={style}>
<circle id="loading-inner" cx="75" cy="75" r="60" />
</svg>
</div>
);
};

Expand Down
6 changes: 6 additions & 0 deletions src/components/CommonLoading/index.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#load {
margin: auto;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: 75px;
animation: loading 3s linear infinite;
#loading-inner {
Expand Down
2 changes: 2 additions & 0 deletions src/components/LoopCircleLoading/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import './index.scss';
const LoopCircleLoading = () => {
return (
<div className="load-container-block">
<div className="load-container-loopCircle">
<div className="container container1">
<div className="circle circle1"></div>
Expand All @@ -22,6 +23,7 @@ const LoopCircleLoading = () => {
<div className="circle circle4"></div>
</div>
</div>
</div>
);
};

Expand Down
8 changes: 6 additions & 2 deletions src/components/LoopCircleLoading/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@
}

.load-container-loopCircle {
margin: 50px auto;
margin: auto;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: 48px;
height: 48px;
position: relative;
.container1 {
@include container();
.circle2 {
Expand Down
10 changes: 6 additions & 4 deletions src/components/TransverseLoading/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import React from 'react';
import './index.scss';
const TransverseLoading = () => {
return (
<div className="load-container-transverse">
<div className="load1"></div>
<div className="load2"></div>
<div className="load3"></div>
<div className="load-container-block">
<div className="load-container-transverse">
<div className="load1"></div>
<div className="load2"></div>
<div className="load3"></div>
</div>
</div>
);
};
Expand Down
7 changes: 7 additions & 0 deletions src/components/WaveLoading/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@
}

.load-container {

height: 150px;
display: flex;
align-items: center;
justify-content: center;
.container {
margin: auto;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: 100px;
height: 60px;
text-align: center;
Expand Down
14 changes: 14 additions & 0 deletions src/stories/Demo.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import { withKnobs } from '@storybook/addon-knobs';
import { CommonLoading } from '~/components';
import Container from './compoment/DemoContainer';
storiesOf('Demo', module)
.addDecorator(withKnobs)
.add('Demo', () => {
return (
<Container>

</Container>
);
});
Loading

0 comments on commit 3cd3aa5

Please sign in to comment.