This repository has been archived by the owner on Apr 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #547 from LiskHQ/546-spinner
Add Spinner component - Closes #546
- Loading branch information
Showing
5 changed files
with
76 additions
and
0 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,12 @@ | ||
import React from 'react'; | ||
import styles from './spinner.css'; | ||
|
||
const Spinner = () => ( | ||
<span className={styles.spinner}> | ||
<div className={styles.bounce1} /> | ||
<div className={styles.bounce2} /> | ||
<div className={styles.bounce3} /> | ||
</span> | ||
); | ||
|
||
export default Spinner; |
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,13 @@ | ||
import React from 'react'; | ||
import { expect } from 'chai'; | ||
import { mount } from 'enzyme'; | ||
import Spinner from './index'; | ||
|
||
describe('Spinner', () => { | ||
it('should render 1 span and 3 divs', () => { | ||
const wrapper = mount(<Spinner />); | ||
expect(wrapper.find('span')).to.have.lengthOf(1); | ||
expect(wrapper.find('div')).to.have.lengthOf(3); | ||
}); | ||
}); | ||
|
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,41 @@ | ||
.spinner { | ||
width: 40px; | ||
text-align: center; | ||
display: inline-block; | ||
} | ||
|
||
.bounce1, .bounce2, .bounce3 { | ||
width: 8px; | ||
height: 8px; | ||
background-color: #aaa; | ||
|
||
border-radius: 100%; | ||
display: inline-block; | ||
-webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both; | ||
animation: sk-bouncedelay 1.4s infinite ease-in-out both; | ||
} | ||
|
||
.bounce1 { | ||
-webkit-animation-delay: -0.32s; | ||
animation-delay: -0.32s; | ||
} | ||
.bounce2 { | ||
-webkit-animation-delay: -0.16s; | ||
animation-delay: -0.16s; | ||
} | ||
|
||
// Spinner animations | ||
@-webkit-keyframes sk-bouncedelay { | ||
0%, 80%, 100% { -webkit-transform: scale(0.5) } | ||
40% { -webkit-transform: scale(1.0) } | ||
} | ||
|
||
@keyframes sk-bouncedelay { | ||
0%, 80%, 100% { | ||
-webkit-transform: scale(0.5); | ||
transform: scale(0.5); | ||
} 40% { | ||
-webkit-transform: scale(1.0); | ||
transform: scale(1.0); | ||
} | ||
} |
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,9 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
|
||
import Spinner from './'; | ||
|
||
storiesOf('Spinner', module) | ||
.add('default', () => ( | ||
<Spinner/> | ||
)); |