PromucFlow_constructor/app/client/src/components/ads/Spinner.tsx
devrk96 028070eeb2
Feature: Variable addition in light and dark theme (#677)
* variables defined in light and dark constants in theme.

* warning message removed

* Fixing create app btn click opening form

* blackShades removed and icon color in application card fixed

* state change fixed

* type of light and dark constants added

Co-authored-by: Satbir Singh <satbir121@gmail.com>
2020-09-23 19:36:50 +05:30

59 lines
1.2 KiB
TypeScript

import React from "react";
import styled, { keyframes } from "styled-components";
import { sizeHandler, IconSize } from "./Icon";
import { Classes } from "./common";
const rotate = keyframes`
100% {
transform: rotate(360deg);
}
`;
const dash = keyframes`
0% {
stroke-dasharray: 1, 150;
stroke-dashoffset: 0;
}
50% {
stroke-dasharray: 90, 150;
stroke-dashoffset: -35;
}
100% {
stroke-dasharray: 90, 150;
stroke-dashoffset: -124;
}
`;
const SvgContainer = styled.svg<SpinnerProp>`
animation: ${rotate} 2s linear infinite;
width: ${props => sizeHandler(props.size)}px;
height: ${props => sizeHandler(props.size)}px;
`;
const SvgCircle = styled.circle`
stroke: ${props => props.theme.colors.spinner};
stroke-linecap: round;
animation: ${dash} 1.5s ease-in-out infinite;
stroke-width: ${props => props.theme.spaces[1]}px;
`;
export type SpinnerProp = {
size?: IconSize;
};
Spinner.defaultProp = {
size: "small",
};
export default function Spinner(props: SpinnerProp) {
return (
<SvgContainer
viewBox="0 0 50 50"
className={Classes.SPINNER}
size={props.size}
>
<SvgCircle cx="25" cy="25" r="20" fill="none"></SvgCircle>
</SvgContainer>
);
}