Skip to content

Commit bb78c77

Browse files
authored
Merge pull request #28 from MadinventorZero/organization
Organization
2 parents fe3d282 + 0c9612e commit bb78c77

17 files changed

+657
-489
lines changed

app/src/components/bottom/BottomPanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import BottomTabs from './BottomTabs';
33
import { Resizable } from 're-resizable';
44

55

6-
const BottomPanel = () => {
6+
const BottomPanel = (props): JSX.Element => {
77
return (
88
<Resizable
99
enable={{
@@ -12,7 +12,7 @@ const BottomPanel = () => {
1212
minHeight={'50%'}
1313
>
1414
<div className="bottom-panel" >
15-
<BottomTabs />
15+
<BottomTabs isThemeLight={props.isThemeLight}/>
1616
</div>
1717
</Resizable>
1818
);

app/src/components/bottom/BottomTabs.tsx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import Tabs from '@material-ui/core/Tabs';
55
import Tab from '@material-ui/core/Tab';
66
import CodePreview from './CodePreview';
77
import StylesEditor from './StylesEditor';
8+
import CustomizationPanel from '../../containers/CustomizationPanel'
9+
import CreationPanel from './CreationPanel'
810
import Box from '@material-ui/core/Box';
911
import Tree from '../../tree/TreeChart';
1012
import { emitKeypressEvents } from 'readline';
@@ -14,7 +16,7 @@ import { styleContext } from '../../containers/AppContainer';
1416
import MenuItem from '@material-ui/core/MenuItem';
1517
import Select from '@material-ui/core/Select';
1618

17-
const BottomTabs = () => {
19+
const BottomTabs = (props): JSX.Element => {
1820
// state that controls which tab the user is on
1921
const [state, dispatch] = useContext(StateContext);
2022
const [tab, setTab] = useState(0);
@@ -56,18 +58,28 @@ const BottomTabs = () => {
5658
<Tab
5759
disableRipple
5860
classes={{ root: classes.tabRoot, selected: classes.tabSelected }}
59-
label="Code Preview"
61+
label="Creation Panel"
6062
/>
6163
<Tab
6264
disableRipple
6365
classes={{ root: classes.tabRoot, selected: classes.tabSelected }}
64-
label="Component Tree"
66+
label="Customization"
6567
/>
6668
<Tab
6769
disableRipple
6870
classes={{ root: classes.tabRoot, selected: classes.tabSelected }}
6971
label="CSS Editor"
7072
/>
73+
<Tab
74+
disableRipple
75+
classes={{ root: classes.tabRoot, selected: classes.tabSelected }}
76+
label="Code Preview"
77+
/>
78+
<Tab
79+
disableRipple
80+
classes={{ root: classes.tabRoot, selected: classes.tabSelected }}
81+
label="Component Tree"
82+
/>
7183
</Tabs>
7284
<div className={classes.projectTypeWrapper}>
7385
<FormControl size='small'>
@@ -86,9 +98,11 @@ const BottomTabs = () => {
8698
</FormControl>
8799
</div>
88100
</Box>
89-
{tab === 0 && <CodePreview theme={theme} setTheme={setTheme} />}
90-
{tab === 1 && <Tree data={components} />}
101+
{tab === 0 && <CreationPanel isThemeLight={props.isThemeLight} />}
102+
{tab === 1 && <CustomizationPanel isThemeLight={props.isThemeLight} />}
91103
{tab === 2 && <StylesEditor theme={theme} setTheme={setTheme} />}
104+
{tab === 3 && <CodePreview theme={theme} setTheme={setTheme} />}
105+
{tab === 4 && <Tree data={components} />}
92106
</div>
93107
);
94108
};

app/src/components/bottom/CodePreview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const CodePreview: React.FC<{
3838
<div
3939
ref={wrapper}
4040
style={{
41-
height: '40vh',
41+
height: '100%',
4242
maxWidth: '100%',
4343
justifyContent: 'center',
4444
}}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React, { useContext } from 'react';
2+
import ComponentPanel from '../right/ComponentPanel'
3+
import StatePropsPanel from '../right/StatePropsPanel'
4+
import HTMLPanel from '../left/HTMLPanel'
5+
6+
const CreationPanel = (props): JSX.Element => {
7+
return (
8+
<div className="creation-panel" >
9+
<ComponentPanel isThemeLight={props.isThemeLight}/>
10+
<HTMLPanel isThemeLight={props.isThemeLight}/>
11+
<StatePropsPanel isThemeLight={props.isThemeLight}/>
12+
</div>
13+
);
14+
};
15+
16+
export default CreationPanel;

app/src/components/bottom/StylesEditor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const StylesEditor: React.FC<{
7070
className='text-editor'
7171
ref={wrapper}
7272
style={{
73-
height: '40vh',
73+
height: '100%',
7474
maxWidth: '100%',
7575
justifyContent: 'center',
7676
}}
@@ -89,7 +89,7 @@ const StylesEditor: React.FC<{
8989
enableBasicAutocompletion={true}
9090
enableLiveAutocompletion={true}
9191
/>
92-
<Fab className='btn' onClick={saveCss} color="secondary" aria-label="add">
92+
<Fab className='bttn' onClick={saveCss} color="secondary" aria-label="add">
9393
<SaveIcon />
9494
</Fab>
9595
</div>
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import React, { useState, useCallback, useContext, useEffect } from 'react';
2+
import Grid from '@material-ui/core/Grid';
3+
import StateContext from '../../context/context';
4+
import HTMLItem from './HTMLItem';
5+
import { makeStyles } from '@material-ui/core/styles';
6+
7+
/*
8+
DESCRIPTION: This is the bottom half of the left panel, starting from the 'HTML
9+
Elements' header. The boxes containing each HTML element are rendered in
10+
HTMLItem, which itself is rendered by this component.
11+
12+
Central state contains all available HTML elements (stored in the HTMLTypes property).
13+
The data for HTMLTypes is stored in HTMLTypes.tsx and is added to central state in
14+
initialState.tsx.
15+
16+
Hook state:
17+
-tag:
18+
*/
19+
20+
const DragDropPanel = (props): JSX.Element => {
21+
// const classes = useStyles();
22+
const [state, dispatch] = useContext(StateContext);
23+
const {isThemeLight} = props;
24+
25+
// const useStyles = makeStyles({
26+
// lightThemeFontColor: {
27+
// color: '#186BB4'
28+
// },
29+
// darkThemeFontColor: {
30+
// color: '#ffffff'
31+
// },
32+
// });
33+
34+
const handleDelete = (id: number): void => {
35+
dispatch({
36+
type: 'DELETE ELEMENT',
37+
payload: id
38+
});
39+
};
40+
41+
// filter out separator so that it will not appear on the html panel
42+
const htmlTypesToRender = state.HTMLTypes.filter(type => type.name !== 'separator');
43+
console.log('Types', htmlTypesToRender)
44+
return (
45+
<div className="HTMLItems">
46+
<div id="HTMLItemsTopHalf">
47+
<Grid
48+
id="HTMLItemsGrid"
49+
>
50+
{htmlTypesToRender.map(option => (
51+
<HTMLItem
52+
name={option.name}
53+
key={`html-${option.name}`}
54+
id={option.id}
55+
Icon={option.icon}
56+
handleDelete={handleDelete}
57+
isThemeLight={isThemeLight}
58+
/>
59+
))}
60+
</Grid>
61+
</div>
62+
</div>
63+
);
64+
};
65+
66+
export default DragDropPanel;

0 commit comments

Comments
 (0)