Skip to content

Commit 5f18d78

Browse files
committed
Merge branch 'dev' into victor/sidebar
2 parents 8bb26bc + 4b1f14a commit 5f18d78

25 files changed

+277
-114
lines changed

app/src/components/ContextAPIManager/ContextManager.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import { RootState } from '../../redux/store';
1515

1616
const useStyles = makeStyles({
1717
contextContainer: {
18-
backgroundColor: 'white',
19-
height: 'fit-content'
18+
backgroundColor: '#191919',
19+
height: 'fit-content',
2020
}
2121
});
2222

@@ -33,7 +33,7 @@ const ContextManager = (props): JSX.Element => {
3333
};
3434

3535
const background_Color = isDarkMode ? '#21262b' : 'white'
36-
const color = isDarkMode ? 'white' : 'black'
36+
const color = isDarkMode ? 'white' : 'white'
3737

3838
return (
3939
<React.Fragment>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ const CreateContainer = () => {
122122
<Divider orientation="vertical" variant="middle" flexItem />
123123
<Grid item>
124124
<Typography
125-
style={{ color: 'black' }}
125+
style={{ color: 'white' }}
126126
variant="h6"
127127
gutterBottom={true}
128128
>

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const AddContextForm = ({
3030
isDarkMode: store.darkMode.isDarkMode,
3131
state: store.appState
3232
}));
33-
const color = isDarkMode ? 'white' : 'black';
33+
const color = isDarkMode ? 'black' : 'white';
3434

3535
//handler for submitting new context for creation
3636
const handleSubmit = () => {
@@ -113,6 +113,7 @@ const AddContextForm = ({
113113
</Snackbar>
114114
<Button
115115
variant="contained"
116+
color="primary"
116117
onClick={handleSubmit}
117118
disabled={btnDisabled}
118119
>
@@ -140,7 +141,7 @@ const AddContextForm = ({
140141
</Select>
141142
</FormControl>
142143
<Button
143-
color="error"
144+
color="primary"
144145
variant="contained"
145146
onClick={handleDeleteContextClick}
146147
>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const AddDataForm = ({ handleClickInputData, currentContext }) => {
1919
}
2020
handleClickInputData(currentContext, dataContext);
2121
};
22-
const color = isDarkMode ? 'white' : 'black';
22+
const color = isDarkMode ? 'black' : 'white';
2323

2424
const handleChange = (e) => {
2525
setDataContext((prevDataContext) => {

app/src/components/StateManagement/CreateTab/components/StatePropsPanel.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,15 +510,15 @@ const useStyles = makeStyles((theme: Theme) => ({
510510
textAlign: 'center',
511511
margin: '-20px 0px 5px 150px',
512512
borderStyle: 'none',
513-
transition: '0.3s'
513+
transition: '0.3s',
514514
// borderRadius: "25px",
515515
},
516516
rootToggle: {
517517
color: '#696969',
518518
fontSize: '0.85rem'
519519
},
520520
lightThemeFontColor: {
521-
color: '#155084'
521+
color: 'white'
522522
},
523523
darkThemeFontColor: {
524524
color: '#fff'
@@ -575,7 +575,7 @@ const useStyles = makeStyles((theme: Theme) => ({
575575
},
576576
inputTextLight: {
577577
'& .MuiInputBase-input': {
578-
color: 'rgba(0,0,0,0.54)'
578+
color: 'white'
579579
}
580580
}
581581
}));

app/src/components/StateManagement/CreateTab/components/TableParentProps.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ const TableParentProps = props => {
119119

120120
const useStyles = makeStyles({
121121
themeLight: {
122-
color: 'rgba(0,0,0,0.54)',
122+
color: 'white',
123123
'& button:hover':{
124124
backgroundColor: 'LightGray'
125125
},
126126
'& button':{
127-
color: 'black'
127+
color: 'white'
128128
},
129129
'& .MuiTablePagination-root': {
130130
color: 'rbga(0,0,0,0.54)'

app/src/components/StateManagement/CreateTab/components/TablePassedInProps.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ const TablePassedInProps = props => {
111111
// colors of state mgmt modal
112112
const useStyles = makeStyles({
113113
themeLight: {
114-
color: 'rgba(0,0,0,0.54)',
114+
color: 'white',
115115
'& button:hover':{
116116
backgroundColor: 'LightGray'
117117
},
118118
'& button':{
119-
color: 'black'
119+
color: 'white'
120120
},
121121
'& .MuiTablePagination-root': {
122122
color: 'rbga(0,0,0,0.54)'

app/src/components/StateManagement/CreateTab/components/TableStateProps.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,12 @@ const TableStateProps = props => {
116116

117117
const useStyles = makeStyles({
118118
themeLight: {
119-
color: 'rgba(0,0,0,0.54)',
119+
color: 'white',
120120
'& button:hover':{
121121
backgroundColor: 'LightGray'
122122
},
123123
'& button':{
124-
color: 'black'
124+
color: 'white'
125125
}
126126
},
127127
themeDark: {

app/src/components/StateManagement/StateManagement.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const StateManager = (props): JSX.Element => {
3636
// add hook here to access which component has been clicked
3737
// then this will re-render the dataTable
3838

39-
const background_Color = isDarkMode ? '#21262b' : 'white';
39+
const background_Color = isDarkMode ? '#21262b' : '#191919';
4040
const color = isDarkMode ? 'white' : 'black';
4141

4242
return (
@@ -52,9 +52,9 @@ const StateManager = (props): JSX.Element => {
5252
<Tab
5353
label="Create/Edit"
5454
value="1"
55-
style={{ color: '#003366' }}
55+
style={{ color: 'white' }}
5656
/>
57-
<Tab label="Display" value="2" style={{ color: '#003366' }} />
57+
<Tab label="Display" value="2" style={{ color: 'white' }} />
5858
</TabList>
5959
</Box>
6060
<TabPanel value="1">

app/src/components/bottom/BottomTabs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const BottomTabs = (props): JSX.Element => {
4949
return (
5050
<div
5151
className={`${classes.root} ${classes.rootLight}`}
52-
style={{ backgroundColor: '#003366' }}
52+
style={{ backgroundColor: '#191919' }}
5353
>
5454
<Box
5555
display="flex"

app/src/components/bottom/CodePreview.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ const CodePreview: React.FC<{
8787
<div
8888
ref={wrapper}
8989
style={{
90+
top: '1vw',
9091
height: '100%',
9192
maxWidth: '100%',
9293
justifyContent: 'center'

app/src/components/left/HTMLPanel.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Button, InputLabel } from '@mui/material';
22
import React, { useCallback, useEffect, useState } from 'react';
33
import { useDispatch, useSelector } from 'react-redux';
44

5+
import { BorderColor } from '@mui/icons-material';
56
import { RootState } from '../../redux/store';
67
import TextField from '@mui/material/TextField';
78
import { addElement } from '../../redux/reducers/slice/appStateSlice';
@@ -332,13 +333,13 @@ const useStyles = makeStyles({
332333
fontFamily: 'Roboto, Raleway, sans-serif',
333334
fontSize: '85%',
334335
textAlign: 'center',
335-
borderStyle: 'none',
336336
transition: '0.3s',
337337
borderRadius: '4px',
338-
alignSelf: 'center'
338+
alignSelf: 'center',
339+
border: '1px solid #186BB4'
339340
},
340341
lightThemeFontColor: {
341-
color: '#C6C6C6',
342+
color: '#155084',
342343
'& .MuiInputBase-root': {
343344
color: 'rgba (0, 0, 0, 0.54)'
344345
}

app/src/components/main/Canvas.tsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect } from 'react';
1+
import React, { useEffect, useState } from 'react';
22
import { useDrop, DropTargetMonitor } from 'react-dnd';
33
import { ItemTypes } from '../../constants/ItemTypes';
44
import { Component, DragItem } from '../../interfaces/Interfaces';
@@ -9,7 +9,8 @@ import { useDispatch, useSelector } from 'react-redux';
99
import {
1010
changeFocus,
1111
addChild,
12-
snapShotAction
12+
snapShotAction,
13+
toggleCodePreview
1314
} from '../../redux/reducers/slice/appStateSlice';
1415
import { RootState } from '../../redux/store';
1516

@@ -18,7 +19,7 @@ function Canvas(props): JSX.Element {
1819
(store: RootState) => ({
1920
state: store.appState,
2021
contextParam: store.contextSlice,
21-
isDarkMode: store.darkMode.isDarkMode
22+
isDarkMode: store.darkMode.isDarkMode,
2223
})
2324
);
2425
const dispatch = useDispatch();
@@ -126,7 +127,7 @@ function Canvas(props): JSX.Element {
126127
const defaultCanvasStyle = {
127128
width: '100%',
128129
minHeight: '100%',
129-
backgroundColor: isOver ? '#FAFED1' : '#FBFBFB',
130+
backgroundColor: isOver ? '#191919' : '#191919',
130131
border: '1px solid #FBFBF2',
131132
borderStyle: isOver ? 'dotted' : 'solid',
132133
aspectRatio: 'auto 774 / 1200',
@@ -150,15 +151,15 @@ function Canvas(props): JSX.Element {
150151
currentComponent.style
151152
);
152153
return (
153-
<div
154-
className={'componentContainer'}
155-
ref={drop}
156-
data-testid="drop"
157-
style={!isDarkMode ? canvasStyle : darkCombinedCanvasStyle}
158-
onClick={onClickHandler}
159-
>
160-
{renderChildren(currentComponent.children)}
161-
</div>
154+
<div
155+
className={'componentContainer'}
156+
ref={drop}
157+
data-testid="drop"
158+
style={!isDarkMode ? canvasStyle : darkCombinedCanvasStyle}
159+
onClick={onClickHandler}
160+
>
161+
{renderChildren(currentComponent.children)}
162+
</div>
162163
);
163164
}
164165

app/src/components/main/CanvasContainer.tsx

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,55 @@
1-
import React from 'react';
1+
import React, { useState } from 'react';
22
import Canvas from './Canvas';
3+
import { useDispatch, useSelector } from 'react-redux';
4+
import { RootState } from '../../redux/store';
5+
import CodePreview from '../bottom/CodePreview';
6+
import { toggleCodePreview } from '../../redux/reducers/slice/appStateSlice';
7+
import { Button } from '@mui/material';
38

49
// The CanvasContainer sets the boundaries on the width/height of the canvas
510
function CanvasContainer(props): JSX.Element {
11+
const [theme, setTheme] = useState('solarized_light'); // theme for ACE editor, taken from BottomTabs
12+
const { state } = useSelector(
13+
(store: RootState) => ({
14+
state: store.appState,
15+
})
16+
);
17+
const dispatch = useDispatch();
18+
19+
// onClickCodePreview swaps the rendered component from the canvas to the code preview editor
20+
const onClickCodePreview = () => {
21+
dispatch(toggleCodePreview());
22+
console.log(state.codePreview);
23+
}
24+
625
const canvasContainerStyle = {
726
width: '100%',
827
backgroundColor: 'lightgrey',
928
border: '2px Solid grey',
1029
overflow: 'auto',
1130
};
1231

32+
const codePreviewStyle = {
33+
position: 'absolute',
34+
width: 'max-content',
35+
height: 'max-content',
36+
bottom: '100px',
37+
right: '51vw',
38+
textAlign: 'center',
39+
color: '#ffffff',
40+
backgroundColor: '#151515'
41+
} as const;
42+
1343
return (
1444
<div style={canvasContainerStyle}>
15-
16-
<Canvas isThemeLight={props.isThemeLight}/>
45+
{state.codePreview && <CodePreview theme={theme} setTheme={setTheme}/>}
46+
{!state.codePreview && <Canvas isThemeLight={props.isThemeLight}/>}
47+
<Button
48+
style={codePreviewStyle}
49+
onClick={onClickCodePreview}
50+
>
51+
Code Preview
52+
</Button>
1753
</div>
1854
);
1955
}

app/src/components/main/DirectChildHTML.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ function DirectChildHTML({ childId, name, type, typeId, style }: ChildElement) {
5252
const interactiveStyle = {
5353
border:
5454
state.canvasFocus.childId === childId
55-
? '3px solid #186BB4'
56-
: '1px solid grey'
55+
? '4px solid #186BB4'
56+
: '2px solid #4d8cc4'
5757
};
5858

5959
const combinedStyle = combineStyles(
@@ -71,7 +71,7 @@ function DirectChildHTML({ childId, name, type, typeId, style }: ChildElement) {
7171
id={`canv${childId}`}
7272
>
7373
<span>
74-
<strong style={{ color:'black'}}>
74+
<strong style={{ color:'white'}}>
7575
{HTMLType.placeHolderShort}
7676
</strong>
7777
<DeleteButton

app/src/components/main/DirectChildHTMLNestable.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ function DirectChildHTMLNestable({
137137
};
138138

139139
// interactive style to change color when nested element is hovered over
140-
if (isOver) defaultNestableStyle['yellow'];
141-
defaultNestableStyle['backgroundColor'] = isOver ? 'yellow' : defaultNestableStyle['backgroundColor'];
140+
if (isOver) defaultNestableStyle['rgba(24, 107, 180, 0.2)'];
141+
defaultNestableStyle['backgroundColor'] = isOver ? 'rgba(24, 107, 180, 0.2)' : defaultNestableStyle['backgroundColor'];
142142

143143
const combinedStyle = combineStyles(
144144
combineStyles(combineStyles(defaultNestableStyle, HTMLType.style), style),
@@ -171,7 +171,7 @@ function DirectChildHTMLNestable({
171171
id={`canv${childId}`}
172172
>
173173
<span>
174-
<strong style={{ color: 'black' }}>{HTMLType.placeHolderShort}
174+
<strong style={{ color: 'white' }}>{HTMLType.placeHolderShort}
175175
</strong>
176176
<strong style={{ color: "#0099E6" }}>{attributes && attributes.compLink ? ` ${attributes.compLink}` : ''}
177177
</strong>

app/src/components/right/ComponentPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ const useStyles = makeStyles({
303303
fontSize: '0.85rem'
304304
},
305305
lightThemeFontColor: {
306-
color: '#C6C6C6',
306+
color: 'white',
307307
'& .MuiInputBase-root': {
308308
color: 'rgba (0, 0, 0, 0.54)'
309309
}

0 commit comments

Comments
 (0)