Skip to content

Commit d1f4067

Browse files
authored
Merge pull request #1137 from civictechindex/Footer-Input-description
Added description to footer Email-Text-Field;
2 parents 6d01cfe + 69f3ae6 commit d1f4067

File tree

1 file changed

+75
-53
lines changed

1 file changed

+75
-53
lines changed

src/components/Footer/subscribeSection.js

Lines changed: 75 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const SubscribeSection = ({ size }) => {
1313
const classes = useStyles();
1414
const [inputValue, setInputValue] = useState('');
1515
const [message, setMessage] = useState('');
16+
const ariaLabel = { 'aria-label': 'Email Text Field' };
1617

1718
const submitEmail = (event) => {
1819
event.preventDefault();
@@ -52,76 +53,97 @@ const SubscribeSection = ({ size }) => {
5253
);
5354
case 'success':
5455
return (
55-
<Typography variant='h5' color='textSecondary' className={classes.successMessage}>
56+
<Typography
57+
variant='h5'
58+
color='textSecondary'
59+
className={classes.successMessage}
60+
>
5661
Thanks for subscribing!
5762
<br />
58-
We will be in touch soon.
63+
We will be in touch soon.
5964
</Typography>
6065
);
6166
default:
6267
return null;
6368
}
6469
};
6570

66-
return (
67-
message === 'success' ? (
68-
<Box>
69-
{messageSwitch(message)}
70-
</Box>
71-
) : (
72-
<Box >
73-
<Grid container className={size === 'lg' ? classes.subscribeSectionLarge : classes.subscribeSectionSmall} >
74-
<Grid className={size === 'lg' ? null : classes.newsLetter} >
75-
<Typography
76-
variant='body2'
77-
color='textSecondary'
78-
className={size !== 'lg'
71+
return message === 'success' ? (
72+
<Box>{messageSwitch(message)}</Box>
73+
) : (
74+
<Box>
75+
<Grid
76+
container
77+
className={
78+
size === 'lg'
79+
? classes.subscribeSectionLarge
80+
: classes.subscribeSectionSmall
81+
}
82+
>
83+
<Grid className={size === 'lg' ? null : classes.newsLetter}>
84+
<Typography
85+
variant='body2'
86+
color='textSecondary'
87+
className={
88+
size !== 'lg'
7989
? `${classes.sectionPaddingSm}`
8090
: `${classes.sectionPaddingLg}`
81-
}
82-
>
83-
Newsletter
84-
</Typography>
85-
<Typography
86-
variant='body1'
87-
color='textSecondary'
88-
className={size !== 'lg'
91+
}
92+
>
93+
Newsletter
94+
</Typography>
95+
<Typography
96+
variant='body1'
97+
color='textSecondary'
98+
className={
99+
size !== 'lg'
89100
? `${classes.sectionPaddingSm}`
90101
: `${classes.sectionPaddingLg}`
91-
}
92-
>
93-
To receive updates about new projects and trending topics on the index, subscribe here.
94-
</Typography>
95-
</Grid>
96-
<form onSubmit={submitEmail} >
97-
<Typography
98-
variant='body2'
99-
color='textSecondary'
100-
className={size !== 'lg'
102+
}
103+
>
104+
To receive updates about new projects and trending topics on the
105+
index, subscribe here.
106+
</Typography>
107+
</Grid>
108+
<form onSubmit={submitEmail}>
109+
<Typography
110+
variant='body2'
111+
color='textSecondary'
112+
className={
113+
size !== 'lg'
101114
? `${classes.sectionPaddingSm}`
102115
: `${classes.sectionPaddingLg}`
103-
}>
104-
E-mail
105-
</Typography>
106-
<Grid className={size === 'lg' ? null : classes.emailSubscribe} >
107-
<TextField
108-
onInput={(e) => setInputValue(e.target.value)}
109-
placeholder='name@domain.com'
110-
type='email'
111-
variant='outlined'
112-
className={size !== 'lg'
116+
}
117+
>
118+
E-mail
119+
</Typography>
120+
<Grid className={size === 'lg' ? null : classes.emailSubscribe}>
121+
<TextField
122+
onInput={(e) => setInputValue(e.target.value)}
123+
placeholder='name@domain.com'
124+
inputProps={ariaLabel}
125+
type='email'
126+
variant='outlined'
127+
className={
128+
size !== 'lg'
113129
? `${classes.sectionPaddingSm}`
114130
: `${classes.sectionPaddingLg}`
115-
}
116-
/>
117-
<Button color='primary' onClick={submitEmail} className={classes.submitBtn}>Submit</Button>
118-
</Grid>
119-
</form>
120-
{messageSwitch(message)}
121-
122-
</Grid>
123-
</Box>
124-
)
131+
}
132+
/>
133+
<Button
134+
type='submit'
135+
value='Submit'
136+
color='primary'
137+
onClick={submitEmail}
138+
className={classes.submitBtn}
139+
>
140+
Submit
141+
</Button>
142+
</Grid>
143+
</form>
144+
{messageSwitch(message)}
145+
</Grid>
146+
</Box>
125147
);
126148
};
127149

0 commit comments

Comments
 (0)