Skip to content

Commit 4fec593

Browse files
authored
Merge pull request #200 from m2mathew/fix/improve_new_sponsor_form_alert_ux
Fix/improve new sponsor form alert ux
2 parents f228f3b + 56ec27a commit 4fec593

File tree

2 files changed

+28
-16
lines changed

2 files changed

+28
-16
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "tmac-website",
33
"description": "Website for the Texas Music Administrators Conference",
4-
"version": "2.37.0",
4+
"version": "2.38.0",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/m2mathew/tmac-website"

src/components/sponsors/SponsorsNew/NewSponsorFormikForm.tsx

+27-15
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
} from '.';
1515
import { SPONSOR_LEVEL_OPTIONS } from './constants';
1616
import CloudinaryUploadWidget from '../../shared/CloudinaryUploadWidget';
17-
import CtaButton from '../../shared/CtaButton';
1817
import CustomSelect from '../../shared/CustomSelect';
1918
import CustomTextField from '../../shared/CustomTextField';
2019
import EnhancedAlert from '../../shared/EnhancedAlert';
@@ -73,6 +72,7 @@ const NewSponsorFormikForm: React.FC<Props> = ({
7372
}
7473

7574
const shouldPreventSubmit = hasTouchedForm && (hasErrors || !imageUrl);
75+
const isReadyToSubmit = hasTouchedForm && !shouldPreventSubmit;
7676

7777
return (
7878
<Form onSubmit={onFormikSubmit}>
@@ -169,26 +169,38 @@ const NewSponsorFormikForm: React.FC<Props> = ({
169169
value={formikValues.honeypot}
170170
/>
171171

172-
<Box
173-
mb={2.5}
174-
mt={1}
175-
width="100%"
176-
>
177-
<EnhancedAlert severity={shouldPreventSubmit ? 'error' : 'info'}>
178-
Please enter a value in each required field and upload a logo image.
179-
</EnhancedAlert>
180-
</Box>
172+
<Collapse in={!isReadyToSubmit}>
173+
<Box
174+
mb={2.5}
175+
mt={1}
176+
width="100%"
177+
>
178+
<EnhancedAlert severity={shouldPreventSubmit ? 'error' : 'info'}>
179+
Please enter a value in each required field and upload a logo image.
180+
</EnhancedAlert>
181+
</Box>
182+
</Collapse>
183+
184+
<Collapse in={isReadyToSubmit}>
185+
<Box
186+
mb={2.5}
187+
mt={1}
188+
width="100%"
189+
>
190+
<EnhancedAlert severity="success">
191+
Data looks good! Press the button below to add this sponsor.
192+
</EnhancedAlert>
193+
</Box>
194+
</Collapse>
181195

182-
<CtaButton
196+
<Button
183197
disabled={shouldPreventSubmit}
184-
fontWeight={600}
185-
rightArrow
186198
size="large"
187199
type="submit"
188-
width={240}
200+
variant="contained"
189201
>
190202
Add Sponsor
191-
</CtaButton>
203+
</Button>
192204
</Form>
193205
);
194206
};

0 commit comments

Comments
 (0)