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

Commit

Permalink
fix: merge master of fix/component
Browse files Browse the repository at this point in the history
  • Loading branch information
Summer-andy committed Dec 4, 2019
2 parents a640e08 + 6f7f065 commit 9b0b603
Show file tree
Hide file tree
Showing 27 changed files with 835 additions and 140 deletions.
57 changes: 34 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</div>

### 项目介绍
基于 React 的 Loading 组件
一个基于 React 的 Loading 组件库

#### Demo

Expand All @@ -36,28 +36,34 @@ import { BoxLoading } from 'react-loadingg'

#### 🎉 组件 API

| 组件 | color | speed | style |
| -------------------- | ----- | ----- | ----- |
| BabelLoading ||||
| BlockLoading || 🚧 ||
| BoxLoading ||||
| BlockReserveLoading ||||
| CircleLoading ||||
| CircleToBlockLoading || 🚧 ||
| CommonLoading || 🚧 ||
| DisappearedLoading ||||
| LoopCircleLoading || 🚧 ||
| NineCellLoading ||||
| TouchBallLoading ||||
| TransverseLoading || 🚧 ||
| WaveLoading || 🚧 ||
| WaveTopBottomLoading ||||
| WindMillLoading ||||
| JumpCircleLoading ||||
| MeteorRainLoading ||||
| RotateCircleLoading ||||
| StickyBallLoading ||||
| SemipolarLoading ||||
| 组件 | color | speed | size | style |
| -------------------- | ----- | ----- | ----- | ----- |
| BabelLoading ||| 🚧 ||
| BlockLoading || 🚧 | 🚧 ||
| BoxLoading ||| 🚧 ||
| BlockReserveLoading ||| 🚧 ||
| CircleLoading ||| 🚧 ||
| CircleToBlockLoading || 🚧 | 🚧 ||
| CommonLoading || 🚧 | 🚧 ||
| DisappearedLoading ||| 🚧 ||
| LoopCircleLoading || 🚧 | 🚧 ||
| NineCellLoading ||| 🚧 ||
| TouchBallLoading ||| 🚧 ||
| TransverseLoading || 🚧 | 🚧 ||
| WaveLoading || 🚧 | 🚧 ||
| WaveTopBottomLoading ||| 🚧 ||
| WindMillLoading ||| 🚧 ||
| JumpCircleLoading |||||
| MeteorRainLoading |||||
| RotateCircleLoading |||||
| StickyBallLoading |||||
| SemipolarLoading |||||
| SolarSystemLoading |||||
| LadderLoading |||||
| HeartBoomLoading |||||
| RollBoxLoading |||||
| RectGraduallyShowLoading |||||

#### ❤️ 组件列表

- [x] BlockLoading
Expand All @@ -80,6 +86,11 @@ import { BoxLoading } from 'react-loadingg'
- [x] RotateCircleLoading
- [x] StickyBallLoading
- [x] SemipolarLoading
- [x] SolarSystemLoading
- [x] LadderLoading
- [x] HeartBoomLoading
- [x] RollBoxLoading
- [x] RectGraduallyShowLoading
- [ ] 持续开发中...

#### ⌨️ 组件开发
Expand Down
2 changes: 1 addition & 1 deletion src/components/BlockLoading/animate.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { keyframes } from 'styled-components';
const $InColor = '#f9c094';
const $color = '#00adb5'
const $color = '#00adb5';
const Rotate = keyframes`
0% {
transform: rotate(0deg);
Expand Down
70 changes: 70 additions & 0 deletions src/components/HeartBoomLoading/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import React from 'react';
import styled, { keyframes } from 'styled-components';

const boom = keyframes`
0% {
transform: rotate(45deg) scale(1);
}
20% {
transform: rotate(45deg) scale(1.1);
}
40% {
transform: rotate(45deg) scale(1);
}
60% {
transform: rotate(45deg) scale(1.2);
}
100% {
transform: rotate(45deg) scale(1);
}
`;


const LoadContainer = styled.div`
width: 50px;
height: 50px;
position: relative;
display: flex;
align-items: center;
justify-content: center;
/* overflow: hidden; */
`;

const Heart = styled.div`
width: ${props => props.size === 'small' ? 22 : (props.size === 'large' ? 30 : 26)}px;
height: ${props => props.size === 'small' ? 22 : (props.size === 'large' ? 30 : 26)}px;
background-color: ${props => props.color || '#00adb5'};
position: relative;
transform: rotate(45deg);
animation: ${boom} ${props => props.speed || 2}s ease infinite;
&::before {
content: '';
width: 100%;
height: 100%;
border-radius: 50%;
background-color: ${props => props.color || '#00adb5'};
position: absolute;
left: -50%;
bottom: 0;
}
&::after {
content: '';
width: 100%;
height: 100%;
border-radius: 50%;
background-color: ${props => props.color || '#00adb5'};
position: absolute;
top: -50%;
right: 0;
}
`

const HeartBoomLoading = ({ style, color, speed, size }) => {
return (
<LoadContainer style={style}>
<Heart color={color} speed={speed} size={size}/>
</LoadContainer>
);
};

export default HeartBoomLoading;
26 changes: 12 additions & 14 deletions src/components/JumpCircleLoading/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ import styled, { keyframes } from 'styled-components';

const bounce = keyframes`
0% {
transform: translateY(0);
width: 22px;
height: 14px;
transform: translateY(0) scaleX(1.2) scaleY(0.8);
}
30% {
width: 18px;
height: 18px;
25% {
transform: translateY(-10px) scaleX(1) scaleY(1);
}
100% {
background-color: #f9c094;
Expand All @@ -22,34 +19,35 @@ const LoadContainer = styled.div`
height: 64px;
position: relative;
overflow: hidden;
transform: scaleX()
`;

const Circle = styled.div`
width: 18px;
height: 18px;
width: ${props => props.size === 'small' ? 12 : (props.size === 'large' ? 20 : 16)}px;
height: ${props => props.size === 'small' ? 12 : (props.size === 'large' ? 20 : 16)}px;
border-radius: 50%;
position: absolute;
bottom: 4px;
left: 16px;
left: ${props => props.size === 'small' ? 19 : (props.size === 'large' ? 15 : 17)}px;
background-color: ${props => props.color || '#00adb5' };
animation: ${bounce} ${props => props.speed || 0.5}s ease-out infinite alternate;
`;

const BottomReac = styled.div`
width: 28px;
width: ${props => props.size === 'small' ? 24 : (props.size === 'large' ? 32 : 28)}px;
height: 4px;
position: absolute;
bottom: 0px;
left: 11px;
left: ${props => props.size === 'small' ? 13 : (props.size === 'large' ? 9 : 11)}px;
background-color: ${props => props.color || '#00adb5' };
`


const JumpCircleLoading = ({ style, color, speed }) => {
const JumpCircleLoading = ({ style, color, speed, size }) => {
return (
<LoadContainer style={style}>
<Circle color={color} speed={speed}/>
<BottomReac color={color}/>
<Circle color={color} speed={speed} size={size}/>
<BottomReac color={color} size={size}/>
</LoadContainer>
);
};
Expand Down
153 changes: 153 additions & 0 deletions src/components/LadderLoading/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
import React from 'react';
import styled, { keyframes } from 'styled-components';

const leftLadderMove = keyframes`
0% {
transform: translateY(68px);
}
10%,
50% {
transform: translateY(0);
}
60%,
100% {
transform: translateY(-68px);
}
`;

const rightLadderMove = keyframes`
0%,
40% {
transform: translateY(68px);
}
50%,
90% {
transform: translateY(0);
}
100% {
transform: translateY(-68px);
}
`;

const RowLadderOneMove = keyframes`
0%,
10% {
transform: translateY(68px);
}
20%,
60% {
transform: translateY(0);
}
70%,
100% {
transform: translateY(-68px);
}
`;

const RowLadderTwoMove = keyframes`
0%,
20% {
transform: translateY(68px);
}
30%,
70% {
transform: translateY(0);
}
80%,
100% {
transform: translateY(-68px);
}
`;

const RowLadderThreeMove = keyframes`
0%,
30% {
transform: translateY(68px);
}
40%,
80% {
transform: translateY(0);
}
90%,
100% {
transform: translateY(-68px);
}
`;

const LoadContainer = styled.div`
width: ${props => props.size === 'small' ? 16 : (props.size === 'large' ? 24 : 20)}px;
height: ${props => props.size === 'small' ? 60 : (props.size === 'large' ? 68 : 64)}px;
position: relative;
overflow: hidden;
`;

const LeftLadder = styled.div`
height: 0;
width: 1px;
border-bottom: ${props => props.size === 'small' ? 60 : (props.size === 'large' ? 68 : 64)}px solid ${props => props.color || '#00adb5'};
border-left: 1px solid transparent;
border-right: 1px solid transparent;
position: absolute;
left: 0;
bottom: 0;
animation: ${leftLadderMove} ${props => props.speed || 4}s ease infinite;
`;

const RightLadder = styled.div`
height: 0;
width: 1px;
border-bottom: ${props => props.size === 'small' ? 60 : (props.size === 'large' ? 68 : 64)}px solid ${props => props.color || '#00adb5'};
border-left: 1px solid transparent;
border-right: 1px solid transparent;
position: absolute;
right: 0;
bottom: 0;
animation: ${rightLadderMove} ${props => props.speed || 4}s ease infinite;
`;

const RowLadderOne = styled.div`
height: 1px;
width: 18px;
background-color: ${props => props.color || '#00adb5'};
position: absolute;
left: 50%;
margin-left: -9px;
top: 10px;
animation: ${RowLadderOneMove} ${props => props.speed || 4}s ease infinite;
`

const RowLadderTwo = styled.div`
height: 1px;
width: 18px;
background-color: ${props => props.color || '#00adb5'};
position: absolute;
left: 50%;
margin-left: -9px;
top: 30px;
animation: ${RowLadderTwoMove} ${props => props.speed || 4}s ease infinite;
`

const RowLadderThree = styled.div`
height: 1px;
width: 18px;
background-color: ${props => props.color || '#00adb5'};
position: absolute;
left: 50%;
margin-left: -9px;
top: 50px;
animation: ${RowLadderThreeMove} ${props => props.speed || 4}s ease infinite;
`

const LadderLoading = ({ style, color, speed, size }) => {
return (
<LoadContainer style={style}>
<LeftLadder color={color} speed={speed} size={size}/>
<RightLadder color={color} speed={speed} size={size}/>
<RowLadderOne color={color} speed={speed} size={size}/>
<RowLadderTwo color={color} speed={speed} size={size}/>
<RowLadderThree color={color} speed={speed} size={size}/>
</LoadContainer>
);
};

export default LadderLoading;
8 changes: 4 additions & 4 deletions src/components/MeteorRainLoading/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const moveTo = keyframes`
`;

const LoadContainer = styled.div`
width: 80px;
height: 80px;
width: ${props => props.size === 'small' ? 68 : (props.size === 'large' ? 88 : 80)}px;
height: ${props => props.size === 'small' ? 68 : (props.size === 'large' ? 88 : 80)}px;
position: relative;
transform: rotateZ(45deg);
> div:nth-of-type(1) {
Expand Down Expand Up @@ -83,9 +83,9 @@ const Star = styled.div`
animation: ${scaling} ${props => props.speed || 3}s ease-in-out infinite, ${moveTo} ${props => props.speed || 3}s ease-in-out infinite;
`

const MeteorRainLoading = ({ style, color, speed }) => {
const MeteorRainLoading = ({ style, color, speed, size }) => {
return (
<LoadContainer style={style}>
<LoadContainer style={style} size={size}>
{
Array.from(Array(9)).map((item, index) => <Star color={color} speed={speed} key={index}/>)
}
Expand Down
Loading

0 comments on commit 9b0b603

Please sign in to comment.