From 1b4668a5adc7be8f2bb91b91c24d0e8c70709137 Mon Sep 17 00:00:00 2001 From: Nesrine Sghaier Date: Sat, 12 Mar 2022 21:31:48 +0100 Subject: [PATCH] fix: resolve issues, change spinner sizes --- src/components/Button.tsx | 46 +++++++++++++++++++++++++++----------- src/components/Spinner.tsx | 10 ++++----- src/pages/ButtonsPage.tsx | 6 ++--- 3 files changed, 40 insertions(+), 22 deletions(-) diff --git a/src/components/Button.tsx b/src/components/Button.tsx index 9522369d2..a9a4f3e1d 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -75,11 +75,27 @@ const gradientDuoToneClasses: Record = { }; const sizeClasses: Record = { - xs: 'text-xs px-3 py-2', - sm: 'text-sm px-3 py-2', - md: 'text-sm px-5 py-2.5', - lg: 'text-base px-5 py-3', - xl: 'text-base px-6 py-3.5', + xs: 'text-xs px-2 py-1', + sm: 'text-sm px-3 py-1.5', + md: 'text-sm px-4 py-2', + lg: 'text-base px-5 py-2.5', + xl: 'text-base px-6 py-3', +}; + +const iconSizeClasses: Record = { + xs: '!px-1', + sm: '!px-1.5', + md: '!px-2', + lg: '!p-2.5', + xl: '!p-3', +}; + +const previousSize: Record = { + xs: 'xs', + sm: 'xs', + md: 'sm', + lg: 'md', + xl: 'lg', }; export const Button: FC = ({ @@ -115,21 +131,25 @@ export const Button: FC = ({ {...props} > - {loader && } - - {!iconButton && iconPosition === 'start' && Icon && } - {children} - {!iconButton && iconPosition === 'end' && Icon && } - {iconButton && Icon && } + {iconButton ? ( + Icon && + ) : ( + <> + {loader && } + {!loader && iconPosition === 'start' && Icon && } + {children} + {iconPosition === 'end' && Icon && } + + )} {label && ( diff --git a/src/components/Spinner.tsx b/src/components/Spinner.tsx index ea9714088..0a65def24 100644 --- a/src/components/Spinner.tsx +++ b/src/components/Spinner.tsx @@ -20,11 +20,11 @@ const colorClasses: Record = { }; const sizeClasses: Record = { - xs: 'w-4 h-4', - sm: 'w-6 h-6', - md: 'w-8 h-8', - lg: 'w-10 h-10', - xl: 'w-12 h-12', + xs: 'w-3 h-3', + sm: 'w-4 h-4', + md: 'w-6 h-6', + lg: 'w-8 h-8', + xl: 'w-10 h-10', }; export const Spinner: FC = ({ color = 'blue', size = 'md' }) => ( diff --git a/src/pages/ButtonsPage.tsx b/src/pages/ButtonsPage.tsx index 3b3fb0244..9ffaaa7d1 100644 --- a/src/pages/ButtonsPage.tsx +++ b/src/pages/ButtonsPage.tsx @@ -246,10 +246,8 @@ const ButtonsPage: FC = () => { Loader
- - +