Skip to content

Commit 31a5201

Browse files
authored
Merge pull request #1 from oslabs-beta/contextTab
Context tab
2 parents 3f0276a + 933d7d5 commit 31a5201

File tree

7 files changed

+109
-0
lines changed

7 files changed

+109
-0
lines changed

app/src/components/bottom/BottomTabs.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import CodePreview from './CodePreview';
77
import StylesEditor from './StylesEditor';
88
import CustomizationPanel from '../../containers/CustomizationPanel'
99
import CreationPanel from './CreationPanel'
10+
import ContextManager from './ContextManager'
1011
import Box from '@material-ui/core/Box';
1112
import Tree from '../../tree/TreeChart';
1213
import FormControl from '@material-ui/core/FormControl';
@@ -78,6 +79,11 @@ const BottomTabs = (props): JSX.Element => {
7879
classes={{ root: classes.tabRoot, selected: classes.tabSelected }}
7980
label="Component Tree"
8081
/>
82+
<Tab
83+
disableRipple
84+
classes={{ root: classes.tabRoot, selected: classes.tabSelected }}
85+
label="Context Manager"
86+
/>
8187
</Tabs>
8288
<div className={classes.projectTypeWrapper}>
8389
<FormControl size='small'>
@@ -101,6 +107,7 @@ const BottomTabs = (props): JSX.Element => {
101107
{tab === 2 && <StylesEditor theme={theme} setTheme={setTheme} />}
102108
{tab === 3 && <CodePreview theme={theme} setTheme={setTheme} />}
103109
{tab === 4 && <Tree data={components} />}
110+
{tab === 5 && <ContextManager theme={theme} setTheme={setTheme} />}
104111
</div>
105112
);
106113
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import ContextAssigner from 'app/src/components/right/ContextAssigner.tsx';
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import React, { useContext } from 'react';
2+
import ComponentPanel from '../right/ComponentPanel';
3+
import ContextAssigner from '../right/ContextAssigner';
4+
import ContextMenu from '../right/ContextMenu';
5+
import ContextTree from '../right/ContextTree';
6+
import HTMLPanel from '../left/HTMLPanel';
7+
import { styleContext } from '../../containers/AppContainer';
8+
import CssBaseline from '@mui/material/CssBaseline';
9+
import Box from '@mui/material/Box';
10+
import Container from '@mui/material/Container';
11+
import { styled } from '@mui/material/styles';
12+
13+
14+
15+
const ContextManager= (props): JSX.Element => {
16+
// const {style} = useContext(styleContext);
17+
return (
18+
<React.Fragment>
19+
{/* <CssBaseline /> */}
20+
<Container style={{"backgroundColor": "white", "height" : "100%", "width": "100%"}} >
21+
<Box display="grid" gridTemplateColumns="repeat(12, 1fr)" gap={0}>
22+
<Box gridColumn="span 4" style={{"border": "1px solid black", "height": "100%"}}>
23+
<Box style={{"height" : "50em", "border": "1px solid black"}}>
24+
<ContextMenu />
25+
</Box>
26+
<Box style={{"height" : "50em", "border": "1px solid black"}}>
27+
<ContextAssigner/>
28+
</Box>
29+
</Box>
30+
<Box gridColumn="span 8" style={{"border": "1px solid black"}}>
31+
<ContextTree/>
32+
</Box>
33+
</Box>
34+
</Container>
35+
</React.Fragment>
36+
37+
);
38+
};
39+
40+
export default ContextManager;

app/src/components/bottom/CreationPanel.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const CreationPanel = (props): JSX.Element => {
1010
const {style} = useContext(styleContext);
1111
return (
1212
<div className="creation-panel" style={style}>
13+
1314
<ComponentPanel isThemeLight={props.isThemeLight}/>
1415
<HTMLPanel isThemeLight={props.isThemeLight}/>
1516
<StatePropsPanel isThemeLight={props.isThemeLight}/>
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+
import StateContext from '../../context/context';
8+
9+
export default function ContextAssigner() {
10+
const [age, setAge] = React.useState('');
11+
const [componentList, dispatch] = React.useContext(StateContext);
12+
13+
console.log(componentList);
14+
const handleChange = (event: SelectChangeEvent) => {
15+
setAge(event.target.value as string);
16+
};
17+
18+
return (
19+
20+
<Box sx={{ minWidth:100 }}>
21+
<FormControl fullWidth>
22+
<InputLabel id="demo-simple-select-label">Select Component</InputLabel>
23+
<Select
24+
labelId="demo-simple-select-label"
25+
id="demo-simple-select"
26+
value={age}
27+
label="Age"
28+
onChange={handleChange}
29+
>
30+
{componentList.components.map((component) => {
31+
return <MenuItem value={component.name}>{component.name}</MenuItem>
32+
})}
33+
</Select>
34+
</FormControl>
35+
</Box>
36+
);
37+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* imput component
2+
input component
3+
button component
4+
*/
5+
import React from 'react';
6+
7+
8+
const ContextMenu = () => {
9+
return (
10+
<h1>This is from context menu</h1>
11+
)
12+
}
13+
14+
export default ContextMenu;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
3+
const ContextTree = () => {
4+
return (
5+
<h1>Our beautiful tree is here</h1>
6+
)
7+
}
8+
9+
export default ContextTree;

0 commit comments

Comments
 (0)