From 7e50c72ea7f30c9df583b1d458b64f998a0c0398 Mon Sep 17 00:00:00 2001 From: Lukas Jakob Date: Tue, 28 Feb 2023 07:50:05 -0600 Subject: [PATCH] refactor(AsyncButton): replace spinner --- packages/app/src/Element/AsyncButton.css | 15 +-------------- packages/app/src/Element/AsyncButton.tsx | 24 +++++++----------------- 2 files changed, 8 insertions(+), 31 deletions(-) diff --git a/packages/app/src/Element/AsyncButton.css b/packages/app/src/Element/AsyncButton.css index 0f8fef5..6e544a2 100644 --- a/packages/app/src/Element/AsyncButton.css +++ b/packages/app/src/Element/AsyncButton.css @@ -2,7 +2,7 @@ button { position: relative; } -.spinner { +.spinner-wrapper { position: absolute; width: 100%; height: 100%; @@ -11,17 +11,4 @@ button { display: flex; justify-content: center; align-items: center; - animation-name: spin; - animation-duration: 800ms; - animation-iteration-count: infinite; - animation-timing-function: linear; -} - -@keyframes spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } } diff --git a/packages/app/src/Element/AsyncButton.tsx b/packages/app/src/Element/AsyncButton.tsx index 3e6f16a..808b655 100644 --- a/packages/app/src/Element/AsyncButton.tsx +++ b/packages/app/src/Element/AsyncButton.tsx @@ -1,5 +1,6 @@ import "./AsyncButton.css"; import { useState } from "react"; +import Spinner from "../Icons/Spinner"; interface AsyncButtonProps extends React.ButtonHTMLAttributes { disabled?: boolean; @@ -7,21 +8,6 @@ interface AsyncButtonProps extends React.ButtonHTMLAttributes children?: React.ReactNode; } -interface LoaderProps { - className: string; -} - -const Loader = ({ className }: LoaderProps) => ( -
- - - -
-); - export default function AsyncButton(props: AsyncButtonProps) { const [loading, setLoading] = useState(false); @@ -41,9 +27,13 @@ export default function AsyncButton(props: AsyncButtonProps) { } return ( - ); }