From 7194f140aac171898f6eec1e290a1704c8b3a14c Mon Sep 17 00:00:00 2001 From: Aaron William Po Date: Mon, 27 Mar 2023 19:00:12 -0400 Subject: [PATCH] refactor: update Spinner component to accept size prop This commit updates the `Spinner` component to accept a `size` prop that determines the width of the spinner --- components/ui/Spinner.tsx | 57 ++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/components/ui/Spinner.tsx b/components/ui/Spinner.tsx index 6dc37e4..a3fb412 100644 --- a/components/ui/Spinner.tsx +++ b/components/ui/Spinner.tsx @@ -1,23 +1,38 @@ -const Spinner = () => ( -
- - Loading... -
-); +import { FC } from 'react'; + +interface SpinnerProps { + size?: 'xs' | 'sm' | 'md' | 'lg'; +} + +const Spinner: FC = ({ size = 'md' }) => { + const spinnerWidths: Record, `w-[${number}px]`> = { + xs: 'w-[10px]', + sm: 'w-[20px]', + md: 'w-[100px]', + lg: 'w-[150px]', + }; + + return ( +
+ + Loading... +
+ ); +}; export default Spinner;