Skip to content

Commit

Permalink
Merge pull request #200 from m2mathew/fix/improve_new_sponsor_form_al…
Browse files Browse the repository at this point in the history
…ert_ux

Fix/improve new sponsor form alert ux
  • Loading branch information
m2mathew authored Sep 18, 2023
2 parents f228f3b + 56ec27a commit 4fec593
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tmac-website",
"description": "Website for the Texas Music Administrators Conference",
"version": "2.37.0",
"version": "2.38.0",
"repository": {
"type": "git",
"url": "https://github.com/m2mathew/tmac-website"
Expand Down
42 changes: 27 additions & 15 deletions src/components/sponsors/SponsorsNew/NewSponsorFormikForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
} from '.';
import { SPONSOR_LEVEL_OPTIONS } from './constants';
import CloudinaryUploadWidget from '../../shared/CloudinaryUploadWidget';
import CtaButton from '../../shared/CtaButton';
import CustomSelect from '../../shared/CustomSelect';
import CustomTextField from '../../shared/CustomTextField';
import EnhancedAlert from '../../shared/EnhancedAlert';
Expand Down Expand Up @@ -73,6 +72,7 @@ const NewSponsorFormikForm: React.FC<Props> = ({
}

const shouldPreventSubmit = hasTouchedForm && (hasErrors || !imageUrl);
const isReadyToSubmit = hasTouchedForm && !shouldPreventSubmit;

return (
<Form onSubmit={onFormikSubmit}>
Expand Down Expand Up @@ -169,26 +169,38 @@ const NewSponsorFormikForm: React.FC<Props> = ({
value={formikValues.honeypot}
/>

<Box
mb={2.5}
mt={1}
width="100%"
>
<EnhancedAlert severity={shouldPreventSubmit ? 'error' : 'info'}>
Please enter a value in each required field and upload a logo image.
</EnhancedAlert>
</Box>
<Collapse in={!isReadyToSubmit}>
<Box
mb={2.5}
mt={1}
width="100%"
>
<EnhancedAlert severity={shouldPreventSubmit ? 'error' : 'info'}>
Please enter a value in each required field and upload a logo image.
</EnhancedAlert>
</Box>
</Collapse>

<Collapse in={isReadyToSubmit}>
<Box
mb={2.5}
mt={1}
width="100%"
>
<EnhancedAlert severity="success">
Data looks good! Press the button below to add this sponsor.
</EnhancedAlert>
</Box>
</Collapse>

<CtaButton
<Button
disabled={shouldPreventSubmit}
fontWeight={600}
rightArrow
size="large"
type="submit"
width={240}
variant="contained"
>
Add Sponsor
</CtaButton>
</Button>
</Form>
);
};
Expand Down

0 comments on commit 4fec593

Please sign in to comment.