This repository has been archived by the owner on Nov 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3df3bad
commit 93f2f99
Showing
5 changed files
with
149 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import React from 'react'; | ||
import styled, { keyframes } from 'styled-components'; | ||
|
||
const bouncedelay = keyframes` | ||
0% { | ||
transform: rotate(360deg); | ||
} | ||
50% { | ||
transform: rotate(180deg); | ||
} | ||
100% { | ||
transform: rotate(0deg); | ||
} | ||
`; | ||
|
||
const LoadingContainer = styled.div` | ||
display: block; | ||
height: 0; | ||
width: 4px; | ||
border-width: 0 4px 60px 4px; | ||
border-style: none solid solid; | ||
border-color: transparent transparent ${props => props.color || '#00adb5'}; | ||
position: relative; | ||
`; | ||
|
||
const ItemFirst = styled.div` | ||
height: 0; | ||
width: 2px; | ||
border-width: 40px 2px 0px 2px; | ||
border-style: solid solid none; | ||
border-color: ${props => props.color || '#00adb5'} transparent transparent; | ||
transform-origin: 0 -2px; | ||
transform: rotate(60deg); | ||
position: absolute; | ||
`; | ||
|
||
const ItemSecord = styled.div` | ||
height: 0; | ||
width: 2px; | ||
border-width: 40px 2px 0px 2px; | ||
border-style: solid solid none; | ||
border-color: ${props => props.color || '#00adb5'} transparent transparent; | ||
transform-origin: 2px -1px; | ||
transform: rotate(180deg); | ||
position: absolute; | ||
`; | ||
|
||
const ItemThree = styled.div` | ||
height: 0; | ||
width: 2px; | ||
border-width: 40px 2px 0px 2px; | ||
border-style: solid solid none; | ||
border-color: ${props => props.color || '#00adb5'} transparent transparent; | ||
transform-origin: 5px 0; | ||
transform: rotate(300deg); | ||
position: absolute; | ||
`; | ||
|
||
const Center = styled.div` | ||
width: 4px; | ||
height: 4px; | ||
border: 3px ${props => props.color || '#00adb5'} solid; | ||
background: #fff; | ||
border-radius: 5px; | ||
transform: translateX(-3px) translateY(-4px); | ||
position:absolute; | ||
`; | ||
|
||
const Con = styled.div` | ||
position: relative; | ||
animation: ${bouncedelay} ${props => props.speed || 5}s infinite linear; | ||
`; | ||
|
||
const WindMillLoading = ({ style, color, speed }) => { | ||
return ( | ||
<LoadingContainer style={style} color={color}> | ||
<Center color={color} /> | ||
<Con speed={speed}> | ||
<ItemFirst color={color} /> | ||
<ItemSecord color={color} /> | ||
<ItemThree color={color} /> | ||
</Con> | ||
</LoadingContainer> | ||
); | ||
}; | ||
|
||
export default WindMillLoading; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { WindMillLoading } from '~/components'; | ||
import Container from './compoment/Container'; | ||
storiesOf('WindMillLoading', module) | ||
.addDecorator(withKnobs) | ||
.add('WindMillLoading', () => { | ||
return ( | ||
<Container> | ||
<WindMillLoading></WindMillLoading> | ||
</Container> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters