Skip to content

Commit c2e17b8

Browse files
committed
change themes no symbols for components and elements and resizableish code snip
2 parents e731891 + e799af5 commit c2e17b8

File tree

10 files changed

+106
-58
lines changed

10 files changed

+106
-58
lines changed

app/src/components/bottom/BottomPanel.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,22 @@ import React, { useContext } from 'react';
22
import { stateContext } from '../../context/context';
33
import BottomTabs from './BottomTabs';
44
// import BottomTabs from './BottomTabs';
5+
import { Resizable } from 're-resizable';
56

67
// const IPC = require('electron').ipcRenderer;
78

89
const BottomPanel = () => {
910
return (
10-
<div className="bottom-panel" style={{ width: '100%' }}>
11-
<BottomTabs />
12-
</div>
11+
<Resizable
12+
enable={{
13+
top: true,
14+
}}
15+
>
16+
<div className="bottom-panel">
17+
<BottomTabs />
18+
</div>
19+
</Resizable>
1320
);
1421
};
1522

16-
export default BottomPanel;
23+
export default BottomPanel;

app/src/components/bottom/BottomTabs.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Tab from '@material-ui/core/Tab';
55
// import Tree from 'react-d3-tree';
66
import CodePreview from './CodePreview';
77
import Box from '@material-ui/core/Box';
8+
import { emitKeypressEvents } from 'readline';
89

910
const BottomTabs = () => {
1011
// state that controls which tab the user is on

app/src/components/bottom/CodePreview.tsx

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,72 @@ import AceEditor from 'react-ace';
44
import { makeStyles } from '@material-ui/core/styles';
55
import 'ace-builds/src-noconflict/mode-javascript';
66
import 'ace-builds/src-noconflict/theme-monokai';
7-
import Button from '@material-ui/core/Button';
7+
import 'ace-builds/src-noconflict/theme-github';
8+
import 'ace-builds/src-noconflict/theme-solarized_dark';
9+
import 'ace-builds/src-noconflict/theme-solarized_light';
10+
import 'ace-builds/src-noconflict/theme-terminal';
811
import { Component } from '../../interfaces/Interfaces';
12+
import NativeSelect from '@material-ui/core/NativeSelect';
13+
import FormControl from '@material-ui/core/FormControl';
14+
15+
const useStyles = makeStyles(theme => ({
16+
formControl: {
17+
margin: theme.spacing(1),
18+
minWidth: 120
19+
},
20+
selectEmpty: {
21+
marginTop: theme.spacing(2)
22+
}
23+
}));
924

1025
const CodePreview = () => {
1126
const [state, dispatch] = useContext(stateContext);
27+
const [theme, setTheme] = useState('monokai');
28+
const classes = useStyles();
1229
const currentComponent = state.components.find(
1330
(elem: Component) => elem.id === state.canvasFocus.componentId
1431
);
1532

1633
const handleCodeSnipChange = val => {
1734
currentComponent.code = val;
18-
}
35+
};
36+
37+
const changeTheme = e => {
38+
setTheme(e.target.value);
39+
};
1940

2041
return (
2142
<div
2243
style={{
2344
height: '90%',
2445
paddingLeft: '0px',
25-
paddingTop: '1rem',
26-
paddingBottom: '1rem',
27-
overflow: 'auto',
46+
// paddingTop: '1rem',
47+
// paddingBottom: '1rem',
48+
// overflow: 'auto',
2849
maxWidth: '100%',
29-
display: 'flex',
50+
// display: 'flex',
3051
justifyContent: 'center'
3152
}}
3253
>
54+
<FormControl fullWidth={true} className={classes.formControl}>
55+
{/* <InputLabel variant="filled" style={{ color: 'white' }}>
56+
Change Theme
57+
</InputLabel> */}
58+
<NativeSelect
59+
style={{ color: 'white' }}
60+
value={theme}
61+
onChange={changeTheme}
62+
>
63+
<option value={'monokai'}>Monokai</option>
64+
<option value={'github'}>Github</option>
65+
<option value={'solarized_dark'}>Solarized Dark</option>
66+
<option value={'terminal'}>Terminal</option>
67+
<option value={'solarized_light'}>Solarized Light</option>
68+
</NativeSelect>
69+
</FormControl>
3370
<AceEditor
3471
mode="javascript"
35-
theme="monokai"
72+
theme={theme}
3673
width="100%"
3774
height="100%"
3875
style={{
@@ -58,6 +95,6 @@ const CodePreview = () => {
5895
);
5996
};
6097

61-
const useStyles = makeStyles(theme => ({}));
98+
// const useStyles = makeStyles(theme => ({}));
6299

63100
export default CodePreview;

app/src/components/left/ComponentPanel.tsx

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const ComponentPanel = (): JSX.Element => {
6868

6969
// Add a new component
7070
const createOption = (inputName: String) => {
71-
// format name so first letter is capitalized and there are no whitespaces
71+
// format name so first letter is capitalized and there are no white spaces
7272
let inputNameClean = inputName.replace(/\s+/g, '');
7373
const formattedName =
7474
inputNameClean.charAt(0).toUpperCase() + inputNameClean.slice(1);
@@ -112,12 +112,6 @@ const ComponentPanel = (): JSX.Element => {
112112
return state.canvasFocus.componentId === targetId ? true : false;
113113
};
114114

115-
// const deleteReusableComponent = (id) => {
116-
// // reducer to modify state.components
117-
// // make sure the component is not a root
118-
// //
119-
// }
120-
121115
return (
122116
<div className={classes.panelWrapper}>
123117
{/* Add a new component*/}
@@ -170,14 +164,15 @@ const ComponentPanel = (): JSX.Element => {
170164
.map(comp => {
171165
//console.log('root comp', comp.name)
172166
return (
173-
<ComponentPanelItem
174-
isFocus={isFocus(comp.id)}
175-
key={`comp-${comp.id}`}
176-
name={comp.name}
177-
id={comp.id}
178-
root={true}
179-
/>
180-
)})}
167+
<ComponentPanelItem
168+
isFocus={isFocus(comp.id)}
169+
key={`comp-${comp.id}`}
170+
name={comp.name}
171+
id={comp.id}
172+
root={true}
173+
/>
174+
);
175+
})}
181176
</Grid>
182177
{/* Display all reusable components */}
183178
<h4>Reusable components</h4>
@@ -188,14 +183,15 @@ const ComponentPanel = (): JSX.Element => {
188183
//console.log('all root comps', state.rootComponents);
189184
//console.log('all reusable comps', state.components);
190185
return (
191-
<ComponentPanelItem
192-
isFocus={isFocus(comp.id)}
193-
key={`comp-${comp.id}`}
194-
name={comp.name}
195-
id={comp.id}
196-
root={false}
197-
/>
198-
)})}
186+
<ComponentPanelItem
187+
isFocus={isFocus(comp.id)}
188+
key={`comp-${comp.id}`}
189+
name={comp.name}
190+
id={comp.id}
191+
root={false}
192+
/>
193+
);
194+
})}
199195
</Grid>
200196
{/* Display navigation components - (only applies to next.js which has routing built in) */}
201197
{state.projectType === 'Next.js' ? (

app/src/components/main/Canvas.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function Canvas() {
4949
}
5050
// if item is not a new instance, change position of element dragged inside div so that the div is the new parent
5151
else {
52-
console.log('dispatch change position')
52+
console.log('dispatch change position');
5353
dispatch({
5454
type: 'CHANGE POSITION',
5555
payload: {

app/src/components/right/SimpleModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ const SimpleModal = (props: any) => {
4646
<Modal
4747
aria-labelledby="simple-modal-title"
4848
aria-describedby="simple-modal-description"
49-
onClose={closeModal}
5049
open={open}
50+
onClose={closeModal}
5151
>
5252
<div
5353
style={{

app/src/containers/MainContainer.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@ import React, { Component } from 'react';
22
import BottomPanel from '../components/bottom/BottomPanel';
33
import CanvasContainer from '../components/main/CanvasContainer';
44

5-
// Main container contains the canvas which renders the components/elements on screen
6-
// and the bottom panel which displays the code for the component
5+
import { Resizable } from "re-resizable";
6+
77
class MainContainer extends Component {
88
render() {
99
return (
1010
<div className="main-container">
11-
<div
12-
className="main" //ref={main} **no function, commenting out**
13-
>
11+
<div className="main">
1412
<CanvasContainer />
1513
</div>
16-
17-
<BottomPanel />
18-
</div>
14+
{/* <Resizable minHeight={'25%'} enable={{ top: true }}> */}
15+
<BottomPanel />
16+
{/* </Resizable> */}
17+
</div>
1918
);
2019
}
2120
}

app/src/public/styles/style.css

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ body {
1717
overflow: hidden;
1818
}
1919
/**************
20-
*
21-
* for Material React Table found in Add Child Props
20+
*
21+
* for Material React Table found in Add Child Props
2222
*
2323
***************/
2424

@@ -36,7 +36,7 @@ body {
3636
}
3737

3838
/*
39-
///////////////////////////////////////////
39+
///////////////////////////////////////////
4040
Remove focus styling
4141
/////////////////////////////////////////////
4242
*/
@@ -73,7 +73,7 @@ header {
7373
} */
7474

7575
/*
76-
///////////////////////////////////////////
76+
///////////////////////////////////////////
7777
BUTTONS
7878
/////////////////////////////////////////////
7979
*/
@@ -83,7 +83,7 @@ BUTTONS
8383
}
8484

8585
/*
86-
///////////////////////////////////////////
86+
///////////////////////////////////////////
8787
LEFT COLUMN
8888
/////////////////////////////////////////////
8989
*/
@@ -131,7 +131,7 @@ LEFT COLUMN
131131
}
132132

133133
/*
134-
///////////////////////////////////////////
134+
///////////////////////////////////////////
135135
MAIN COLUMN
136136
/////////////////////////////////////////////
137137
*/
@@ -214,8 +214,16 @@ h1 {
214214
text-align: center;
215215
}
216216

217+
.ace_scrollbar {
218+
display: none;
219+
}
220+
221+
.ace_print-margin {
222+
display: none;
223+
}
224+
217225
/*
218-
///////////////////////////////////////////
226+
///////////////////////////////////////////
219227
RIGHT COLUMN
220228
/////////////////////////////////////////////
221229
*/
@@ -233,13 +241,14 @@ RIGHT COLUMN
233241
.bottom-panel {
234242
transition: width 250ms ease-in-out;
235243
width: 100%;
236-
height: 33%;
237-
min-height: 260px;
244+
height: 100%;
245+
min-height: 500px;
238246
/* display: flex;
239247
flex-direction: row; */
240248
background-color: #fcfcfc;
241249
/* box-shadow: 0 -5px 7px 2px rgb(255, 0, 0); */
242-
margin-right: 100px;
250+
/* margin-right: 100px;
251+
padding-right: 10px; */
243252
}
244253

245254
.htmlattr {

app/src/reducers/componentReducer.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,8 @@ const reducer = (state: State, action: Action) => {
433433
}
434434

435435
case 'ADD ELEMENT': {
436-
console.log("REDUCER HIT");
437436
const HTMLTypes = [...state.HTMLTypes];
438437
HTMLTypes.push(action.payload);
439-
console.log("MY NEW ARRAY: ", HTMLTypes);
440438
return {
441439
...state,
442440
HTMLTypes

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,12 @@
118118
"immutable": "^4.0.0-rc.12",
119119
"js-cookie": "^2.2.1",
120120
"localforage": "^1.7.2",
121+
"node-fetch": "^2.6.0",
121122
"passport": "^0.4.1",
122123
"passport-github2": "^0.1.12",
123-
"node-fetch": "^2.6.0",
124124
"prettier": "^1.19.1",
125125
"prop-types": "^15.6.2",
126+
"re-resizable": "^6.7.0",
126127
"react": "^16.13.0",
127128
"react-ace": "^8.1.0",
128129
"react-dnd": "^11.1.3",

0 commit comments

Comments
 (0)