diff --git a/src/assets/loading-circles.svg b/src/assets/loading-circles.svg new file mode 100644 index 0000000..b69ce60 --- /dev/null +++ b/src/assets/loading-circles.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/components/button/Button.module.scss b/src/components/button/Button.module.scss index 3a851f7..67980bf 100644 --- a/src/components/button/Button.module.scss +++ b/src/components/button/Button.module.scss @@ -41,4 +41,46 @@ left: 50%; transform: translateX(-50%); + transition: opacity 100ms; +} + +.loadingCircles { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + + svg { + overflow: visible; + + @for $i from 1 through 3 { + :nth-child(#{$i}) { + animation-delay: calc(7 * #{$i}0ms); + } + } + } + + * circle { + fill: black; + + animation: bounce 1s infinite; + } +} + +@keyframes bounce { + 0% { + transform: translateY(0%); + } + + 30% { + transform: translateY(50%); + } + + 70% { + transform: translateY(-50%); + } + + 100% { + transform: translateY(0%); + } } diff --git a/src/components/button/Button.tsx b/src/components/button/Button.tsx index 92f512c..7c241c6 100644 --- a/src/components/button/Button.tsx +++ b/src/components/button/Button.tsx @@ -1,11 +1,27 @@ -import React from "react"; +import React, { useRef } from "react"; import styles from "./Button.module.scss"; +import { ReactComponent } from "../../assets/svgr-custom"; +// @ts-ignore +import { ReactComponent as LoadingCircles } from "../../assets/loading-circles.svg"; -const Button: React.FC<{ children: any }> = ({ children }) => { +interface ButtonProps { + loading?: boolean; + icon?: typeof ReactComponent; + children: any; +} + +const Button: React.FC = ({ children, loading, icon }) => { return ( ); }; diff --git a/src/stories/Button.stories.tsx b/src/stories/Button.stories.tsx index 709ecca..232461e 100644 --- a/src/stories/Button.stories.tsx +++ b/src/stories/Button.stories.tsx @@ -12,4 +12,5 @@ export const defaultButton = Template.bind({}); defaultButton.args = { children: "Test", + loading: false, };