From ec4135357c72871e38718319799eb2117865d2c8 Mon Sep 17 00:00:00 2001 From: adibas03 Date: Fri, 27 Sep 2019 21:48:20 +0100 Subject: [PATCH 1/2] spinner init --- src/components/lib/index.tsx | 2 ++ src/components/lib/spinner/index.tsx | 24 +++++++++++++ src/components/lib/spinner/styled.tsx | 36 +++++++++++++++++++ src/components/lib/youtube/index.tsx | 1 + .../pages/loanOffer/loanAmount/index.tsx | 4 +++ 5 files changed, 67 insertions(+) create mode 100644 src/components/lib/spinner/index.tsx create mode 100644 src/components/lib/spinner/styled.tsx diff --git a/src/components/lib/index.tsx b/src/components/lib/index.tsx index 7afd10d..d62065b 100644 --- a/src/components/lib/index.tsx +++ b/src/components/lib/index.tsx @@ -6,6 +6,7 @@ import Button from "./button"; import Checkbox from "./checkbox"; import TextField from "./textfield"; import Progress from "./progress"; +import Spinner from "./spinner"; import ShowModal from "./modal"; import { Row, Col } from "./grid"; import FieldError from "./feedback/fieldError"; @@ -16,6 +17,7 @@ export { Badge, Checkbox, Progress, + Spinner, Row, Col, Button, diff --git a/src/components/lib/spinner/index.tsx b/src/components/lib/spinner/index.tsx new file mode 100644 index 0000000..a09c324 --- /dev/null +++ b/src/components/lib/spinner/index.tsx @@ -0,0 +1,24 @@ +import React from "react"; +import { StyledSpinner } from "./styled"; + +const Spinner: React.FC<{ size?: string, color?: string }> = ({ size, color }) => ( + + + + + + ); + +Spinner.defaultProps ={ + size: "50", + color: "#ffffff" +}; + +export default Spinner; diff --git a/src/components/lib/spinner/styled.tsx b/src/components/lib/spinner/styled.tsx new file mode 100644 index 0000000..546f0b9 --- /dev/null +++ b/src/components/lib/spinner/styled.tsx @@ -0,0 +1,36 @@ +import styled from "styled-components"; + +const StyledSpinner = styled.svg<{ size: string, color: string }>` + animation: rotate 1s linear infinite; + margin: 0px; + width: ${props => props.size}px; + height: ${props => props.size}px; + + & .path { + stroke: ${props => props.color}; + stroke-linecap: round; + animation: dash 1.7s ease-in-out infinite; + } + + @keyframes rotate { + 100% { + transform: rotate(360deg); + } + } + @keyframes dash { + 0% { + stroke-dasharray: 1, 150; + stroke-dashoffset: 0; + } + 50% { + stroke-dasharray: 90, 150; + stroke-dashoffset: -35; + } + 100% { + stroke-dasharray: 90, 150; + stroke-dashoffset: -124; + } + } +`; + +export { StyledSpinner }; diff --git a/src/components/lib/youtube/index.tsx b/src/components/lib/youtube/index.tsx index defb074..971f905 100644 --- a/src/components/lib/youtube/index.tsx +++ b/src/components/lib/youtube/index.tsx @@ -7,6 +7,7 @@ import React from "react"; export default ({ youtubeId }) => { return (