Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dmitrizzle
Created January 11, 2018 14:59
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save dmitrizzle/5883ca1f72f34398155eb2bc1d0ccfc6 to your computer and use it in GitHub Desktop.
Save dmitrizzle/5883ca1f72f34398155eb2bc1d0ccfc6 to your computer and use it in GitHub Desktop.
A components for displaying "loading" dots with CSS (for ReactJS and Styled Components)
// tools
import React from "react"
import styled from "styled-components"
// styles
const Dots = styled.span`
&::after {
display: inline-block;
animation: ellipsis 1.25s infinite;
content: ".";
width: 1em;
text-align: left;
}
@keyframes ellipsis {
0% {
content: ".";
}
33% {
content: "..";
}
66% {
content: "...";
}
}
`
// return
export default props => {
return <Dots>{props.children}</Dots>
}
@OskarPrzydatek
Copy link

<3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment