1
1
import React , { Fragment , useState } from 'react' ;
2
2
import TextField from '@mui/material/TextField' ;
3
+ import Select from '@mui/material/Select' ;
4
+ import FormControl from '@mui/material/FormControl' ;
3
5
import Autocomplete , { createFilterOptions } from '@mui/material/Autocomplete' ;
4
6
import Button from '@mui/material/Button' ;
5
7
import Box from '@mui/material/Box' ;
6
- import { Typography } from '@mui/material' ;
8
+ import { MenuItem , Typography } from '@mui/material' ;
7
9
import { useSelector } from 'react-redux' ;
8
10
import { RootState } from '../../../../redux/store' ;
9
11
@@ -18,6 +20,7 @@ const AddContextForm = ({
18
20
setContextInput
19
21
} ) => {
20
22
const { allContext } = contextStore ;
23
+ console . log ( 'all contexts' , allContext ) ;
21
24
const [ btnDisabled , setBtnDisabled ] = useState ( false ) ;
22
25
const { state, isDarkMode } = useSelector ( ( store : RootState ) => ( {
23
26
isDarkMode : store . darkMode . isDarkMode ,
@@ -88,10 +91,14 @@ const AddContextForm = ({
88
91
</ li >
89
92
) ;
90
93
94
+ const contexts = allContext . map ( ( context ) => {
95
+ return < MenuItem style = { { color : 'black' } } > { context . name } </ MenuItem > ;
96
+ } ) ;
97
+
91
98
return (
92
99
< Fragment >
93
100
< Typography style = { { color : color } } variant = "h6" gutterBottom = { true } >
94
- Context Input
101
+ Create Context
95
102
</ Typography >
96
103
< Box sx = { { display : 'flex' , gap : 2 , mb : 4 } } >
97
104
< Autocomplete
@@ -134,6 +141,26 @@ const AddContextForm = ({
134
141
Delete
135
142
</ Button >
136
143
</ Box >
144
+ < Typography style = { { color : color } } variant = "h6" gutterBottom = { true } >
145
+ Select Context
146
+ </ Typography >
147
+ < FormControl variant = "filled" >
148
+ < Select
149
+ style = { { border : '1px solid #0099e6' , color : 'black' } }
150
+ value = { '' }
151
+ name = { 'test' }
152
+ displayEmpty
153
+ renderValue = { ( ) => 'no context selected' }
154
+ MenuProps = { { disablePortal : true } }
155
+
156
+ // value={props.selectValue}
157
+ // onChange={props.handleChange}
158
+
159
+ // inputProps={{ className: props.isThemeLight ? `${props.classes.selectInput} ${props.classes.lightThemeFontColor}` : `${props.classes.selectInput} ${props.classes.darkThemeFontColor}` }}
160
+ >
161
+ { contexts }
162
+ </ Select >
163
+ </ FormControl >
137
164
</ Fragment >
138
165
) ;
139
166
} ;
0 commit comments