Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated HTML to MUI components for Home comp #1840

Open
wants to merge 4 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 24 additions & 17 deletions client/src/pages/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
import CheckInButtons from '../components/presentational/CheckInButtons';
import CreateNewProfileButton from '../components/presentational/CreateNewProfileButton';
import { REACT_APP_CUSTOM_REQUEST_HEADER as headerToSend } from '../utils/globalSettings';
import { CircularProgress, Box, Typography } from '@mui/material';
import { CircularProgress, Box, Typography, Select, MenuItem, FormControl, InputLabel } from '@mui/material';

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

Expand All @@ -25,12 +25,13 @@ const h4sx = {
fontSize: {xs: '1.8rem'},
}


const Home = () => {
const [events, setEvents] = useState(null);
const [selectedEvent, setSelectedEvent] = useState('');

const handleEventChange = (e) => {
setSelectedEvent(e.currentTarget.value);
setSelectedEvent(e.target.value);
};

// Fetching only events with checkInReady = true
Expand Down Expand Up @@ -61,6 +62,8 @@ const Home = () => {
);
}



return (
<Box className="home">
<Box className="home-headers">
Expand All @@ -70,39 +73,43 @@ const Home = () => {

{events && events.length > 0 ? (
<Box className="meeting-select-container">
<form
<FormControl
className="form-select-meeting"
autoComplete="off"
onSubmit={(e) => e.preventDefault()}
variant='standard'
>
<Box className="form-row">
<Box className="form-input-select">
<label htmlFor={'meeting-checkin'}>
<InputLabel id='select-meeting-label'>
Select a meeting to check-in:
</label>
</InputLabel>
<Box className="radio-buttons">
<select
name={'meeting-checkin'}
<Select
labelId='select-meeting-label'
className="select-meeting-dropdown"
value={selectedEvent ? selectedEvent : "--SELECT ONE--"}
renderValue={(selected) => (
<Typography sx={{ color: 'red'}}>
{selectedEvent ? selectedEvent : "--SELECT ONE--"}
</Typography>
)}
onChange={handleEventChange}
required
defaultValue="--SELECT ONE--"
>
<option value="--SELECT ONE--" disabled hidden>
--SELECT ONE--
</option>
{events.map((event) => {
return (
<option key={event._id || 0} value={event._id}>
{event?.project?.name + ' - ' + event.name}
</option>
<MenuItem key={event._id || 0} value={event.project?.name + ' - ' + event.name}>
<Typography>
{event?.project?.name + ' - ' + event.name}
</Typography>
</MenuItem>
);
})}
</select>
</Select>
</Box>
</Box>
</Box>
</form>
</FormControl>
</Box>
):(

Expand Down
14 changes: 7 additions & 7 deletions client/src/sass/Home.scss
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,18 @@
}

p {
text-align: left;
text-align: center;
font-weight: bold;
letter-spacing: .05em;
letter-spacing: 0.075em;
}
}
}

// .radio-buttons {
// display: flex;
// justify-content: space-around;
// margin: 8px;
// }
.radio-buttons {
display: flex;
justify-content: space-around;
margin: 8px;
}

.select-meeting-dropdown:-webkit-autofill,
.select-meeting-dropdown:-webkit-autofill:hover,
Expand Down
Loading
Loading