Skip to content

Commit 3fd7d35

Browse files
Merge pull request #15 from jinsoolim/customel
Customel
2 parents 3389b47 + 1782360 commit 3fd7d35

File tree

5 files changed

+21
-13
lines changed

5 files changed

+21
-13
lines changed

app/src/components/bottom/BottomTabs.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,24 @@ import Tree from '../../tree/TreeChart';
99
import { emitKeypressEvents } from 'readline';
1010
import NativeSelect from '@material-ui/core/NativeSelect';
1111
import FormControl from '@material-ui/core/FormControl';
12+
import { styleContext } from '../../containers/AppContainer';
1213

13-
const BottomTabs = ({ style }) => {
14+
15+
const BottomTabs = () => {
1416
// state that controls which tab the user is on
1517
const [state, dispatch] = useContext(StateContext);
1618
const [tab, setTab] = useState(0);
1719
const classes = useStyles();
1820
treeWrapper: HTMLDivElement;
1921
const [theme, setTheme] = useState('monokai');
22+
const { style } = useContext(styleContext);
2023

2124
// method changes the
2225
const handleChange = (event: React.ChangeEvent, value: number) => {
2326
setTab(value);
2427
};
2528

26-
const { HTMLTypes } = state;
27-
const { components } = state;
29+
const { components, HTMLTypes } = state;
2830

2931
const changeTheme = e => {
3032
setTheme(e.target.value);

app/src/containers/LeftContainer.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import React from 'react';
2-
1+
import React, { useContext } from 'react';
32
import Grid from '@material-ui/core/Grid';
4-
53
import ComponentPanel from '../components/left/ComponentPanel';
64
import HTMLPanel from '../components/left/HTMLPanel';
5+
import { styleContext } from './AppContainer';
76

87
// Left-hand portion of the app, where component options are displayed
9-
const LeftContainer = ({ style }): JSX.Element => {
8+
const LeftContainer = (): JSX.Element => {
9+
const { style } = useContext(styleContext);
10+
1011
return (
1112
<div className="column left" style={style}>
1213
<Grid container direction="row" alignItems="center">

app/src/containers/MainContainer.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
import React, { Component } from 'react';
1+
import React, { useContext } from 'react';
22
import BottomPanel from '../components/bottom/BottomPanel';
33
import CanvasContainer from '../components/main/CanvasContainer';
4+
import { styleContext } from './AppContainer';
5+
6+
const MainContainer = () => {
7+
const { style } = useContext(styleContext);
48

5-
const MainContainer = ({ style }) => {
69
return (
7-
<div className="main-container" style={style}>
10+
<div className="main-container" style={style} >
811
<div className="main">
912
<CanvasContainer />
1013
</div>
11-
<BottomPanel style={style}/>
14+
<BottomPanel />
1215
</div>
1316
);
1417
};

app/src/containers/RightContainer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ import DialogContent from '@material-ui/core/DialogContent';
1919
import DialogContentText from '@material-ui/core/DialogContentText';
2020
import DialogTitle from '@material-ui/core/DialogTitle';
2121
import ErrorMessages from '../constants/ErrorMessages';
22+
import { styleContext } from './AppContainer';
2223

2324
// need to pass in props to use the useHistory feature of react router
24-
const RightContainer = ({ style }): JSX.Element => {
25+
const RightContainer = (): JSX.Element => {
2526
const classes = useStyles();
2627
const [state, dispatch] = useContext(StateContext);
2728
const [displayMode, setDisplayMode] = useState('');
@@ -34,6 +35,7 @@ const RightContainer = ({ style }): JSX.Element => {
3435
const [deleteLinkedPageError, setDeleteLinkedPageError] = useState(false);
3536
const [deleteIndexError, setDeleteIndexError] = useState(false);
3637
const [deleteComponentError, setDeleteComponentError] = useState(false);
38+
const { style } = useContext(styleContext);
3739

3840
const resetFields = () => {
3941
const style = configTarget.child

app/src/tree/TreeChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function usePrevious(value) {
1111
return ref.current;
1212
}
1313

14-
function TreeChart({ theme, setTheme, data }) {
14+
function TreeChart({ data }) {
1515
const [state, dispatch] = useContext(StateContext);
1616
const canvasId = state.canvasFocus.componentId;
1717

0 commit comments

Comments
 (0)