Skip to content

Instantly share code, notes, and snippets.

@mrcoles
Last active March 13, 2019 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrcoles/14648f080d915850d6567e5cdc41bc3f to your computer and use it in GitHub Desktop.
Save mrcoles/14648f080d915850d6567e5cdc41bc3f to your computer and use it in GitHub Desktop.
LoaderDots.jsx: a React loader component (to show when waiting on a network call)
import React from 'react';
export default ({
fill = '#666666',
width = 52,
height = 12,
scale = 1,
style = {}
}) => (
<svg
version="1.1"
id="L4"
xmlns="http://www.w3.org/2000/svg"
xmlnsXlink="http://www.w3.org/1999/xlink"
x="0px"
y="0px"
viewBox="0 0 52 12"
enableBackground="new 0 0 0 0"
xmlSpace="preserve"
width={width * scale}
height={height * scale}
style={style}
>
<title>Loading</title>
<circle fill={fill} stroke="none" cx="6" cy="6" r="6" opacity="0">
<animate
attributeName="opacity"
dur="1s"
values="0;1;0"
repeatCount="indefinite"
begin="0.1"
/>
</circle>
<circle fill={fill} stroke="none" cx="26" cy="6" r="6" opacity="0">
<animate
attributeName="opacity"
dur="1s"
values="0;1;0"
repeatCount="indefinite"
begin="0.2"
/>
</circle>
<circle fill={fill} stroke="none" cx="46" cy="6" r="6" opacity="0">
<animate
attributeName="opacity"
dur="1s"
values="0;1;0"
repeatCount="indefinite"
begin="0.3"
/>
</circle>
</svg>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment