-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hl-prefer-box' of https://github.com/gorstdon-cs/gordon…
…-360-ui into hl-prefer-box
- Loading branch information
Showing
7 changed files
with
133 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/views/HousingLottery/components/PreferenceBox/index.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import { | ||
Card, | ||
CardContent, | ||
CardHeader, | ||
Grid, | ||
Table, | ||
TableBody, | ||
TableContainer, | ||
Typography, | ||
FormControl, | ||
RadioGroup, | ||
FormControlLabel, | ||
Radio, | ||
} from '@mui/material'; | ||
import housing from 'services/housing'; | ||
import styles from '../../../../HousingLottery.module.css'; | ||
|
||
function SurveyQuestionBox() { | ||
const [selectedOption, setSelectedOption] = useState(''); // Store the selected option | ||
|
||
// Handle the change of the selected option | ||
const handleOptionChange = (event) => { | ||
setSelectedOption(event.target.value); | ||
}; | ||
|
||
// Your survey question text can go here | ||
const questionText = 'Are you a night owl or a morning bird?'; | ||
|
||
return ( | ||
<Card> | ||
<CardHeader title={questionText} /> | ||
<CardContent> | ||
<FormControl component="fieldset"> | ||
<RadioGroup | ||
aria-label="morning-or-night" | ||
name="morning-or-night" | ||
value={selectedOption} | ||
onChange={handleOptionChange} | ||
> | ||
<FormControlLabel value="night-owl" control={<Radio />} label="Night Owl" /> | ||
<FormControlLabel value="morning-bird" control={<Radio />} label="Morning Bird" /> | ||
</RadioGroup> | ||
<RadioGroup | ||
aria-label="quiet-or-loud" | ||
name="quiet-or-loud" | ||
value={selectedOption} | ||
onChange={handleOptionChange} | ||
> | ||
<FormControlLabel value="quiet" control={<Radio />} label="Quiet" /> | ||
<FormControlLabel value="loud" control={<Radio />} label="Loud" /> | ||
</RadioGroup> | ||
</FormControl> | ||
</CardContent> | ||
</Card> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import React, { useState } from 'react'; | ||
import { Input, Button, Radio, RadioGroup, FormControlLabel } from '@mui/material'; | ||
import housingService from 'services/housing'; | ||
|
||
const HousingLottery = () => { | ||
const [message, setMessage] = useState(''); | ||
const [morningOrNight, setMorningOrNight] = useState(''); | ||
const [loudOrQuiet, setLoudOrQuiet] = useState(''); | ||
|
||
const handleChange = (event) => { | ||
setMessage(event.target.value); | ||
}; | ||
|
||
const handleMorningOrNightChange = (event) => { | ||
setMorningOrNight(event.target.value); | ||
}; | ||
|
||
const handleLoudOrQuietChange = (event) => { | ||
setLoudOrQuiet(event.target.value); | ||
}; | ||
|
||
const handleClick = async () => { | ||
// You can access message, morningOrNight, and loudOrQuiet to submit to your housing service | ||
await housingService.addRoommate({ message, morningOrNight, loudOrQuiet }); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<div> | ||
<label>Are you a night owl or a morning bird?</label> | ||
<RadioGroup | ||
aria-label="morning-or-night" | ||
name="morning-or-night" | ||
value={morningOrNight} | ||
onChange={handleMorningOrNightChange} | ||
> | ||
<FormControlLabel value="night-owl" control={<Radio />} label="Night Owl" /> | ||
<FormControlLabel value="morning-bird" control={<Radio />} label="Morning Bird" /> | ||
</RadioGroup> | ||
</div> | ||
|
||
<div> | ||
<label>Do you consider yourself quiet or loud in the dorm?</label> | ||
<RadioGroup | ||
aria-label="loud-or-quiet" | ||
name="loud-or-quiet" | ||
value={loudOrQuiet} | ||
onChange={handleLoudOrQuietChange} | ||
> | ||
<FormControlLabel value="quiet" control={<Radio />} label="Quiet" /> | ||
<FormControlLabel value="loud" control={<Radio />} label="Loud" /> | ||
</RadioGroup> | ||
</div> | ||
|
||
<Input onChange={handleChange} placeholder="Enter your message" /> | ||
|
||
<Button variant="contained" onClick={handleClick}> | ||
Submit | ||
</Button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default HousingLottery; |
a522bcc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed merge conflict