From 0b0f5e0c073121f70a78e3a7cd7d2cf7e6b51b3b Mon Sep 17 00:00:00 2001 From: Nicola Benaglia Date: Fri, 30 May 2025 08:58:17 +0200 Subject: [PATCH] Refactor CustomButtonAccept --- src/App.tsx | 8 ++++---- src/components/GlobalActions/JoinGroup.tsx | 8 ++++---- src/styles/App-styles.ts | 23 +++++++++++----------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index b898a14..92e0965 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3848,8 +3848,8 @@ function App() { }} > { disabled={isInGroup} > { ({ })); interface CustomButtonProps { - bgColor?: string; - color?: string; + customBgColor?: string; + customColor?: string; } -export const CustomButtonAccept = styled(Box)( - ({ bgColor, color, theme }) => ({ +export const CustomButtonAccept = styled(Box)((props) => { + const { customBgColor, customColor, theme } = props; + return { alignItems: 'center', - backgroundColor: bgColor || theme.palette.background.default, + backgroundColor: customBgColor || theme.palette.background.default, borderColor: theme.palette.background.paper, borderRadius: 5, borderStyle: 'solid', borderWidth: '0.5px', boxSizing: 'border-box', - color: color || theme.palette.background.default, + color: customColor || theme.palette.background.default, cursor: 'pointer', display: 'inline-flex', filter: 'drop-shadow(1px 4px 10.5px rgba(0,0,0,0.3))', @@ -163,16 +164,16 @@ export const CustomButtonAccept = styled(Box)( width: 'fit-content', '&:hover': { opacity: 1, - backgroundColor: bgColor || theme.palette.background.default, - color: color || '#fff', + backgroundColor: customBgColor || theme.palette.background.default, + color: customColor || '#fff', svg: { path: { - fill: color || '#fff', + fill: customColor || '#fff', }, }, }, - }) -); + }; +}); export const CustomInput = styled(TextField)(({ theme }) => ({ backgroundColor: theme.palette.background.default,