Created
April 16, 2019 14:16
-
-
Save didierfranc/2923a3858b22be53b5dba4bddb0db89f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import React from 'react' | |
import { number, string } from 'prop-types' | |
const Spinner = ({ size, ratio, color }) => { | |
const c = size / 2 | |
const r = size / 4 | |
const d = size / ratio | |
return ( | |
<svg width={size} height={size} className="spin"> | |
<path | |
d={`m ${d} ${c} A ${r} ${r} 0 0 0 ${size - d} ${c}`} | |
stroke={color} | |
fill="none" | |
strokeWidth={d} | |
/> | |
</svg> | |
) | |
} | |
Spinner.propTypes = { | |
size: number, | |
ratio: number, | |
color: string, | |
} | |
Spinner.defaultProps = { | |
size: 50, | |
ratio: 15, | |
color: 'black', | |
} | |
export default Spinner |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment