Skip to content

Instantly share code, notes, and snippets.

@guyb7
Created December 12, 2020 21:30
Show Gist options
  • Select an option

  • Save guyb7/a07e186b2961712a72cc77263062ea1b to your computer and use it in GitHub Desktop.

Select an option

Save guyb7/a07e186b2961712a72cc77263062ea1b to your computer and use it in GitHub Desktop.
Simple react spinner with styled components
import styled, { keyframes } from 'styled-components'
const rotate = keyframes`
from {
transform: rotate(0deg);
}
to {
transform: rotate(359deg);
}
`
const Spinner = styled.div`
width: 16px;
height: 16px;
clear: both;
margin: 20px auto;
border: 2px rgba(0, 0, 0, 0.25) solid;
border-top: 2px rgba(0, 0, 0, 1) solid;
border-radius: 50%;
-webkit-animation: ${rotate} .6s infinite linear;
animation: ${rotate} .6s infinite linear;
`
export default Spinner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment