Skip to content

Instantly share code, notes, and snippets.

@danethurber
Created September 14, 2016 15:12
Show Gist options
  • Save danethurber/a55bdeee49d8d00522eabd55fce63c8b to your computer and use it in GitHub Desktop.
Save danethurber/a55bdeee49d8d00522eabd55fce63c8b to your computer and use it in GitHub Desktop.
:root {
--pipColor: #999;
--pipSize: 8px;
--pipSpacing: 3px;
}
@keyframes pulse {
0%, 80%, 100% {
transform: scale(0.8);
opacity: 0;
}
40% {
transform: scale(1);
opacity: 1;
}
}
.indicator {
position: relative;
height: 100%;
width: 100%;
min-height: 100px;
}
.inner {
position: absolute;;
top: 50%;
left: 50%;
display: block;
margin: 0 auto;
text-align: center;
line-height: 0;
transform: translate(-50%, -50%);
width: calc(var(--pipSize) * 3 + var(--pipSpacing) * 3);
}
.pip {
display: inline-block;
margin: 0 calc(var(--pipSpacing)/2);
width: var(--pipSize);
height: var(--pipSize);
background: var(--pipColor);
border-radius: 100%;
animation-fill-mode: both;
animation: pulse 1.4s infinite ease-in-out;
&:first-child {
animation-delay: -0.32s;
}
&:nth-child(2) {
animation-delay: -0.16s;
}
}
import React from 'react'
import autobind from 'autobind-decorator'
import styleable from 'react-styleable'
import css from './activity-indicator.css'
@styleable(css)
@autobind
export default class ActivityIndicator extends React.Component {
render() {
const { css } = this.props
return (
<div className={css.indicator}>
<div className={css.inner}>
<i className={css.pip} />
<i className={css.pip} />
<i className={css.pip} />
</div>
</div>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment