1
+ import * as React from 'react' ;
2
+ import { Box } from "@mui/material" ;
3
+ import Button from '@mui/material/Button' ;
4
+ import InputLabel from '@mui/material/InputLabel' ;
5
+ import MenuItem from '@mui/material/MenuItem' ;
6
+ import FormControl from '@mui/material/FormControl' ;
7
+ import Select , { SelectChangeEvent } from '@mui/material/Select' ;
8
+
9
+
10
+ const style = {
11
+ position : 'absolute' as 'absolute' ,
12
+ top : '50%' ,
13
+ left : '50%' ,
14
+ transform : 'translate(-50%, -50%)' ,
15
+ width : '50%' ,
16
+ display : 'flex-wrap' ,
17
+ maxHeight : '60%' ,
18
+ justifyContent : "center" ,
19
+ textAlign : "center" ,
20
+ bgcolor : 'background.paper' ,
21
+ border : '2px solid #000' ,
22
+ boxShadow : 24 ,
23
+ overflow : 'auto' ,
24
+ p : 4 ,
25
+ } ;
26
+
27
+ const MatchingForm = React . forwardRef ( function MatchingForm ( ) {
28
+ const [ difficulty , setDifficulty ] = React . useState ( '' ) ;
29
+ const [ category , setCategory ] = React . useState ( '' ) ;
30
+ const handleDiffChange = ( event : SelectChangeEvent ) => {
31
+ setDifficulty ( event . target . value ) ;
32
+ } ;
33
+ const handleCatChange = ( event : SelectChangeEvent ) => {
34
+ setCategory ( event . target . value ) ;
35
+ } ;
36
+ const handleConnect = ( ) => {
37
+ console . log ( 'connecting...' )
38
+ }
39
+ return (
40
+ < Box sx = { style } >
41
+ < h2 > < center > Please select a difficulty and question category.</ center > </ h2 >
42
+ < h4 > < center > We will attempt to connect you with a user who chose the same options as you within 30 seconds.</ center > </ h4 >
43
+ < FormControl sx = { { mt : 1 , width : '100%' } } >
44
+ < InputLabel id = "demo-simple-select-helper-label" > Difficulty</ InputLabel >
45
+ < Select
46
+ labelId = "demo-simple-select-helper-label"
47
+ id = "demo-simple-select-helper"
48
+ value = { difficulty }
49
+ label = "Difficulty"
50
+ onChange = { handleDiffChange }
51
+ >
52
+ < MenuItem value = "" >
53
+ < em > None</ em >
54
+ </ MenuItem >
55
+ < MenuItem value = { 'Easy' } > Easy</ MenuItem >
56
+ < MenuItem value = { 'Medium' } > Medium</ MenuItem >
57
+ < MenuItem value = { 'Hard' } > Hard</ MenuItem >
58
+ </ Select >
59
+ { /* <FormHelperText>Difficulty of Question</FormHelperText> */ }
60
+ </ FormControl >
61
+ < FormControl sx = { { mt : 1 , mb : 1 , width : '100%' } } >
62
+ < InputLabel id = "demo-simple-select-helper-label" > Category</ InputLabel >
63
+ < Select
64
+ labelId = "demo-simple-select-helper-label"
65
+ id = "demo-simple-select-helper"
66
+ value = { category }
67
+ label = "Category"
68
+ onChange = { handleCatChange }
69
+ >
70
+ < MenuItem value = "" >
71
+ < em > None</ em >
72
+ </ MenuItem >
73
+ < MenuItem value = { 'Algo' } > Algo</ MenuItem >
74
+ < MenuItem value = { 'ML' } > ML</ MenuItem >
75
+ </ Select >
76
+ { /* <FormHelperText>Difficulty of Question</FormHelperText> */ }
77
+ </ FormControl >
78
+ < Button sx = { { mt : '5%' } } variant = "contained" onClick = { handleConnect } >
79
+ Connect
80
+ </ Button >
81
+ </ Box >
82
+ ) ;
83
+ } ) ;
84
+
85
+ export default MatchingForm
0 commit comments