Skip to content

Commit 0ab315f

Browse files
authored
Merge pull request #1840 from jng34/updateHTMLtoMUIforHomeComp
Updated HTML to MUI components for Home comp
2 parents f312da6 + bea2f63 commit 0ab315f

File tree

2 files changed

+31
-24
lines changed

2 files changed

+31
-24
lines changed

client/src/pages/Home.jsx

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
22
import CheckInButtons from '../components/presentational/CheckInButtons';
33
import CreateNewProfileButton from '../components/presentational/CreateNewProfileButton';
44
import { REACT_APP_CUSTOM_REQUEST_HEADER as headerToSend } from '../utils/globalSettings';
5-
import { CircularProgress, Box, Typography } from '@mui/material';
5+
import { CircularProgress, Box, Typography, Select, MenuItem, FormControl, InputLabel } from '@mui/material';
66

77
import '../sass/Home.scss';
88

@@ -25,12 +25,13 @@ const h4sx = {
2525
fontSize: {xs: '1.8rem'},
2626
}
2727

28+
2829
const Home = () => {
2930
const [events, setEvents] = useState(null);
3031
const [selectedEvent, setSelectedEvent] = useState('');
3132

3233
const handleEventChange = (e) => {
33-
setSelectedEvent(e.currentTarget.value);
34+
setSelectedEvent(e.target.value);
3435
};
3536

3637
// Fetching only events with checkInReady = true
@@ -61,6 +62,8 @@ const Home = () => {
6162
);
6263
}
6364

65+
66+
6467
return (
6568
<Box className="home">
6669
<Box className="home-headers">
@@ -70,39 +73,43 @@ const Home = () => {
7073

7174
{events && events.length > 0 ? (
7275
<Box className="meeting-select-container">
73-
<form
76+
<FormControl
7477
className="form-select-meeting"
7578
autoComplete="off"
7679
onSubmit={(e) => e.preventDefault()}
80+
variant='standard'
7781
>
7882
<Box className="form-row">
7983
<Box className="form-input-select">
80-
<label htmlFor={'meeting-checkin'}>
84+
<InputLabel id='select-meeting-label'>
8185
Select a meeting to check-in:
82-
</label>
86+
</InputLabel>
8387
<Box className="radio-buttons">
84-
<select
85-
name={'meeting-checkin'}
88+
<Select
89+
labelId='select-meeting-label'
8690
className="select-meeting-dropdown"
91+
value={selectedEvent ? selectedEvent : "--SELECT ONE--"}
92+
renderValue={(selected) => (
93+
<Typography sx={{ color: 'red'}}>
94+
{selectedEvent ? selectedEvent : "--SELECT ONE--"}
95+
</Typography>
96+
)}
8797
onChange={handleEventChange}
88-
required
89-
defaultValue="--SELECT ONE--"
9098
>
91-
<option value="--SELECT ONE--" disabled hidden>
92-
--SELECT ONE--
93-
</option>
9499
{events.map((event) => {
95100
return (
96-
<option key={event._id || 0} value={event._id}>
97-
{event?.project?.name + ' - ' + event.name}
98-
</option>
101+
<MenuItem key={event._id || 0} value={event.project?.name + ' - ' + event.name}>
102+
<Typography>
103+
{event?.project?.name + ' - ' + event.name}
104+
</Typography>
105+
</MenuItem>
99106
);
100107
})}
101-
</select>
108+
</Select>
102109
</Box>
103110
</Box>
104111
</Box>
105-
</form>
112+
</FormControl>
106113
</Box>
107114
):(
108115

client/src/sass/Home.scss

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,18 +126,18 @@
126126
}
127127

128128
p {
129-
text-align: left;
129+
text-align: center;
130130
font-weight: bold;
131-
letter-spacing: .05em;
131+
letter-spacing: 0.075em;
132132
}
133133
}
134134
}
135135

136-
// .radio-buttons {
137-
// display: flex;
138-
// justify-content: space-around;
139-
// margin: 8px;
140-
// }
136+
.radio-buttons {
137+
display: flex;
138+
justify-content: space-around;
139+
margin: 8px;
140+
}
141141

142142
.select-meeting-dropdown:-webkit-autofill,
143143
.select-meeting-dropdown:-webkit-autofill:hover,

0 commit comments

Comments
 (0)