-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(components/base): create <Spinner />
use on <ImgLoader />
- Loading branch information
1 parent
e0bf04e
commit a3ea886
Showing
5 changed files
with
83 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// @flow strict | ||
import React from 'react'; | ||
|
||
import './Spinner.scss'; | ||
|
||
type PropsType = { | ||
height: number | string, | ||
width: number | string, | ||
}; | ||
|
||
const Spinner = ({ height, width }: PropsType) => ( | ||
<div | ||
style={{ | ||
height: `${height}px`, | ||
width: `${width}px`, | ||
}} | ||
className="spinner" | ||
> | ||
<div className="spinner__outer-circle" /> | ||
<div className="spinner__inner-circle" /> | ||
</div> | ||
); | ||
|
||
Spinner.defaultProps = { | ||
height: '24', | ||
width: '24', | ||
}; | ||
|
||
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,38 @@ | ||
@import '~styles/functions/px-to-rem'; | ||
@import '~styles/mixins'; | ||
@import '~styles/variables'; | ||
|
||
.spinner { | ||
display: inline-block; | ||
position: relative; | ||
|
||
@include element(outer-circle) { | ||
animation: lds-ripple 1s cubic-bezier(0, 0.2, 0.8, 1) infinite; | ||
border-radius: 50%; | ||
border: px-to-rem(4) solid #222222; | ||
opacity: 1; | ||
position: absolute; | ||
} | ||
|
||
@include element(inner-circle) { | ||
animation-delay: -0.5s; | ||
} | ||
} | ||
|
||
@keyframes lds-ripple { | ||
0% { | ||
top: px-to-rem(28); | ||
left: px-to-rem(28); | ||
width: 0; | ||
height: 0; | ||
opacity: 1; | ||
} | ||
|
||
100% { | ||
top: -1px; | ||
left: -1px; | ||
width: px-to-rem(58); | ||
height: px-to-rem(58); | ||
opacity: 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,13 @@ | ||
// @flow strict | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
|
||
import Spinner from './Spinner'; | ||
|
||
describe('Spinner', () => { | ||
const defaultProps = {}; | ||
|
||
it('tests something', () => { | ||
shallow(<Spinner {...defaultProps} />); | ||
}); | ||
}); |
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