Skip to content

Commit 8db4e7c

Browse files
committed
added context dropdown for assignment tab
Co-authored-by: Sal Saluga [email protected] Co-authored-by: Ken Bains [email protected] Co-authored-by: Bianca Picasso [email protected]
1 parent aba81bc commit 8db4e7c

File tree

3 files changed

+66
-7
lines changed

3 files changed

+66
-7
lines changed
Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,31 @@
11
import { Typography } from '@material-ui/core';
2-
import React from 'react';
2+
import React, { useContext, useState, Fragment, useEffect } from 'react';
33
import ContextTable from './components/ContextTable';
4+
import { useStore } from 'react-redux';
5+
import StateContext from '../../../context/context';
6+
import ContextDropDown from './components/ContextDropDown';
47

58
const AssignContainer = () => {
6-
return <ContextTable />;
9+
const [state, setState] = useState(null);
10+
11+
useEffect(() => {
12+
setState(store.getState().contextSlice);
13+
}, []);
14+
15+
// const [componentList, setComponentList] = useContext(StateContext);
16+
17+
const store = useStore();
18+
19+
console.log(componentList);
20+
21+
//create an onclick for assign
22+
23+
return (
24+
<Fragment>
25+
<ContextDropDown contextList={state} />
26+
<ContextTable />
27+
</Fragment>
28+
);
729
};
830

931
export default AssignContainer;
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import * as React from 'react';
2+
import Box from '@mui/material/Box';
3+
import InputLabel from '@mui/material/InputLabel';
4+
import MenuItem from '@mui/material/MenuItem';
5+
import FormControl from '@mui/material/FormControl';
6+
import Select, { SelectChangeEvent } from '@mui/material/Select';
7+
8+
export default function ContextDropDown({ contextList }) {
9+
// const [context]
10+
console.log(contextList);
11+
const [currentContext, setCurrentContext] = React.useState('');
12+
13+
const handleChange = (event: SelectChangeEvent) => {
14+
setCurrentContext(event.target.value as string);
15+
};
16+
17+
return (
18+
<Box sx={{ minWidth: 120 }}>
19+
<FormControl fullWidth>
20+
<InputLabel id="demo-simple-select-label">Context</InputLabel>
21+
<Select
22+
labelId="demo-simple-select-label"
23+
id="demo-simple-select"
24+
value={currentContext}
25+
label="Current Context"
26+
onChange={handleChange}
27+
>
28+
{
29+
// contextList.map(el => {
30+
// <MenuItem value={el.name}>{el.name}</MenuItem>;
31+
// })
32+
}
33+
</Select>
34+
</FormControl>
35+
</Box>
36+
);
37+
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const CreateContainer = () => {
3434
};
3535

3636
const renderTable = targetContext => {
37-
console.log(targetContext)
37+
console.log(targetContext);
3838
if (!targetContext.values) {
3939
setTableState(defaultTableData);
4040
} else {
@@ -43,8 +43,8 @@ const CreateContainer = () => {
4343
};
4444
return (
4545
<>
46-
<Grid container display="flex" justifyContent="space-evenly" >
47-
<Grid item >
46+
<Grid container display="flex" justifyContent="space-evenly">
47+
<Grid item>
4848
<Grid
4949
container
5050
spacing={2}
@@ -53,7 +53,7 @@ const CreateContainer = () => {
5353
justifyContent="center"
5454
alignItems="center"
5555
>
56-
<Grid item >
56+
<Grid item>
5757
<AddContextForm
5858
contextStore={state}
5959
handleClickSelectContext={handleClickSelectContext}
@@ -64,7 +64,7 @@ const CreateContainer = () => {
6464
</Grid>
6565

6666
<Divider variant="middle" />
67-
<Grid item >
67+
<Grid item>
6868
<AddDataForm
6969
handleClickInputData={handleClickInputData}
7070
contextInput={contextInput}

0 commit comments

Comments
 (0)