Skip to content

Commit 107aa8b

Browse files
Merge pull request #618 from sudhanshutech/fix/modals
Enhancements and fixes in modals
2 parents f3f6d50 + abeb156 commit 107aa8b

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/custom/Modal/index.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ interface ModalFooterProps {
1717
children: React.ReactNode;
1818
variant?: 'filled' | 'transparent';
1919
helpText?: string;
20+
hasHelpText?: boolean;
2021
}
2122

2223
type openModalCallback = (props: {
@@ -54,11 +55,8 @@ const StyledDialog = styled(Dialog)`
5455
}
5556
`;
5657

57-
const StyledHeader = styled('div')(({ theme }) => ({
58-
background:
59-
theme.palette.mode === 'light'
60-
? 'linear-gradient(90deg, #3B687B 0%, #507D90 100%)'
61-
: 'linear-gradient(90deg, #000 0%, #23363F 100%)',
58+
const StyledHeader = styled('div')(() => ({
59+
background: 'linear-gradient(90deg, #3B687B 0%, #507D90 100%)',
6260
color: '#eee',
6361
display: 'flex',
6462
justifyContent: 'space-between',
@@ -103,17 +101,17 @@ export const useModal = ({ headerIcon }: { headerIcon: React.ReactNode }): UseMo
103101

104102
export const ModalBody = styled(Paper)(({ theme }) => ({
105103
padding: '1rem',
106-
backgroundColor: theme.palette.background.secondary
104+
backgroundColor: theme.palette.background.constant?.white
107105
}));
108106

109107
const StyledFooter = styled('div', {
110108
shouldForwardProp: (prop) => prop !== 'variant'
111-
})<ModalFooterProps>(({ theme, variant }) => ({
109+
})<ModalFooterProps>(({ theme, variant, hasHelpText }) => ({
112110
background:
113111
variant == 'filled' ? 'linear-gradient(90deg, #3B687B 0%, #507D90 100%)' : 'transparent',
114112
display: 'flex',
115113
alignItems: 'center',
116-
justifyContent: 'space-between',
114+
justifyContent: hasHelpText ? 'space-between' : 'end',
117115
padding: '1rem',
118116
gap: '1rem',
119117

@@ -159,7 +157,7 @@ export const Modal: React.FC<ModalProps> = ({
159157

160158
export const ModalFooter: React.FC<ModalFooterProps> = ({ helpText, children, variant }) => {
161159
return (
162-
<StyledFooter variant={variant}>
160+
<StyledFooter variant={variant} hasHelpText={!!helpText}>
163161
{helpText && (
164162
<CustomTooltip title={helpText} placement="top">
165163
<IconButton>

0 commit comments

Comments
 (0)