Skip to content

Commit

Permalink
fix: make subscribe dialog responsive (#1998)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpalikova authored Jan 8, 2025
1 parent 79e20ff commit 79d9bda
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
3 changes: 0 additions & 3 deletions src/components/client/campaigns/CampaignDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@ export default function CampaignDetails({ campaign }: Props) {
showExpensesLink={(expensesList && expensesList?.length > 0) || canEditCampaign}
/>
<Grid container spacing={8}>
{subscribeIsOpen && (
<RenderCampaignSubscribeModal setOpen={setSubscribeOpen} campaign={campaign} />
)}
<Grid item xs={12} display="flex" sx={{ mt: 1.5 }}>
<EmailIcon
color="primary"
Expand Down
31 changes: 24 additions & 7 deletions src/components/client/notifications/CampaignSubscribeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const classes = {
const StyledGrid = styled(Grid)(({ theme }) => ({
[`& .${classes.subscribeBtn}`]: {
fontSize: theme.typography.pxToRem(16),
background: `${theme.palette.primary}`,
},
}))

Expand Down Expand Up @@ -116,15 +115,20 @@ export default function RenderCampaignSubscribeModal({ campaign, setOpen }: Moda
<EmailField
label="common:notifications.email-descriptive"
name="email"
sx={{ maxWidth: theme.spacing(50) }}
sx={{
width: '100%',
[theme.breakpoints.up('sm')]: {
width: '70%',
},
}}
/>
</Grid>
<Grid item xs={12}>
<AcceptNewsLetterFieldCampaign name="consent" />
</Grid>
<Grid item xs={12} textAlign="center">
<SubmitButton
sx={{ width: '40%' }}
sx={{ minWidth: theme.spacing(25) }}
className={classes.subscribeBtn}
label="common:notifications.cta.subscribe-button"
loading={loading}
Expand Down Expand Up @@ -163,7 +167,7 @@ export default function RenderCampaignSubscribeModal({ campaign, setOpen }: Moda
}}>
<CloseModalButton onClose={handleClose} />
<React.Fragment>
<EmailIcon color="primary" sx={{ fontSize: '64px' }} />
<EmailIcon color="primary" sx={{ fontSize: theme.typography.pxToRem(64) }} />
<DialogTitle style={{ textAlign: 'center', width: '100%' }}>
{t('common:notifications.subscribe-campaign-title')}
</DialogTitle>
Expand All @@ -176,10 +180,23 @@ export default function RenderCampaignSubscribeModal({ campaign, setOpen }: Moda
: t('common:notifications.subscribe-text-loggedUser')}
</Typography>
</Grid>
<Grid item xs={12} display="flex" justifyContent="space-evenly">
<Grid
item
xs={12}
sx={{
display: 'flex',
justifyContent: 'space-evenly',
flexFlow: 'column',
gap: theme.spacing(2),
alignItems: 'center',

[theme.breakpoints.up('sm')]: {
flexFlow: 'row',
},
}}>
<SubmitButton
type="button"
sx={{ width: '40%' }}
sx={{ minWidth: theme.spacing(25) }}
className={classes.subscribeBtn}
label={
status !== 'authenticated'
Expand All @@ -191,7 +208,7 @@ export default function RenderCampaignSubscribeModal({ campaign, setOpen }: Moda
/>
<SubmitButton
type="button"
sx={{ width: '40%' }}
sx={{ minWidth: theme.spacing(25) }}
variant="outlined"
className={classes.subscribeBtn}
label={
Expand Down
9 changes: 7 additions & 2 deletions src/components/client/notifications/GeneralSubscribeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,20 @@ export default function RenderSubscribeModal({ setOpen }: ModalProps) {
<EmailField
label={t('common:notifications.email-descriptive')}
name="email"
sx={{ width: '70%' }}
sx={{
width: '100%',
[theme.breakpoints.up('sm')]: {
width: '70%',
},
}}
/>
</Grid>
<Grid item xs={12}>
<AcceptNewsLetterField name="consent" />
</Grid>
<Grid item xs={12} textAlign="center">
<SubmitButton
sx={{ width: '40%' }}
sx={{ minWidth: theme.spacing(25) }}
className={classes.subscribeBtn}
label="common:notifications.cta.subscribe-button"
loading={loading}
Expand Down

0 comments on commit 79d9bda

Please sign in to comment.