Skip to content

Commit 22123ef

Browse files
atvanekMatteoDiter
andcommitted
Added select context dropdown
Co-authored-by: Matteo <[email protected]>
1 parent fd85465 commit 22123ef

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

app/src/components/ContextAPIManager/CreateTab/components/AddContextForm.tsx

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import React, { Fragment, useState } from 'react';
22
import TextField from '@mui/material/TextField';
3+
import Select from '@mui/material/Select';
4+
import FormControl from '@mui/material/FormControl';
35
import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
46
import Button from '@mui/material/Button';
57
import Box from '@mui/material/Box';
6-
import { Typography } from '@mui/material';
8+
import { MenuItem, Typography } from '@mui/material';
79
import { useSelector } from 'react-redux';
810
import { RootState } from '../../../../redux/store';
911

@@ -18,6 +20,7 @@ const AddContextForm = ({
1820
setContextInput
1921
}) => {
2022
const { allContext } = contextStore;
23+
console.log('all contexts', allContext);
2124
const [btnDisabled, setBtnDisabled] = useState(false);
2225
const { state, isDarkMode } = useSelector((store: RootState) => ({
2326
isDarkMode: store.darkMode.isDarkMode,
@@ -88,10 +91,14 @@ const AddContextForm = ({
8891
</li>
8992
);
9093

94+
const contexts = allContext.map((context) => {
95+
return <MenuItem style={{ color: 'black' }}>{context.name}</MenuItem>;
96+
});
97+
9198
return (
9299
<Fragment>
93100
<Typography style={{ color: color }} variant="h6" gutterBottom={true}>
94-
Context Input
101+
Create Context
95102
</Typography>
96103
<Box sx={{ display: 'flex', gap: 2, mb: 4 }}>
97104
<Autocomplete
@@ -134,6 +141,26 @@ const AddContextForm = ({
134141
Delete
135142
</Button>
136143
</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>
137164
</Fragment>
138165
);
139166
};

0 commit comments

Comments
 (0)