Skip to content

Commit 567487e

Browse files
committed
Merge branch 'dev' into readmeUpdate
2 parents 210f11d + c62d5ac commit 567487e

File tree

19 files changed

+377
-325
lines changed

19 files changed

+377
-325
lines changed

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

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import {
44
styled,
55
Theme
66
} from "@material-ui/core/styles";
7-
import Button from "@material-ui/core/Button";
87
import {
98
FormControl,
109
FormHelperText,
1110
MenuItem,
1211
InputLabel,
1312
Select,
14-
TextField
13+
TextField,
14+
Button
1515
} from "@material-ui/core";
1616
import StateContext from "../../../../context/context";
1717
import TableStateProps from "./TableStateProps";
@@ -239,13 +239,15 @@ const StatePropsPanel = ({ isThemeLight, data}): JSX.Element => {
239239
</FormHelperText>
240240
</FormControl>
241241
<br />
242-
<MyButton
243-
type="submit"
244-
onClick={submitNewState}
245-
className={isThemeLight ? `${classes.addComponentButton} ${classes.lightThemeFontColor}` : `${classes.addComponentButton} ${classes.darkThemeFontColor}`}
242+
<Button
243+
variant='contained'
244+
color='primary'
245+
type="submit"
246+
onClick={submitNewState}
247+
className={isThemeLight ? `${classes.addComponentButton} ${classes.lightThemeFontColor}` : `${classes.addComponentButton} ${classes.darkThemeFontColor}`}
246248
>
247249
Save
248-
</MyButton>
250+
</Button>
249251
<br />
250252

251253
</FormControl>
@@ -370,7 +372,7 @@ const useStyles = makeStyles((theme: Theme) =>
370372
margin: "-20px 0px 5px 150px",
371373
borderStyle: "none",
372374
transition: "0.3s",
373-
borderRadius: "25px",
375+
// borderRadius: "25px",
374376
},
375377
rootToggle: {
376378
color: "#696969",
@@ -439,14 +441,15 @@ const useStyles = makeStyles((theme: Theme) =>
439441
}
440442
})
441443
);
442-
const MyButton = styled(Button)({
443-
background: "#0099E6",
444-
border: 0,
445-
borderRadius: 3,
446-
boxShadow: "0 0px 0px 2px #1a1a1a",
447-
color: "white",
448-
height: 24,
449-
width: 40,
450-
padding: "0 30px",
451-
});
444+
// change to Button to keep styling consistent
445+
// const MyButton = styled(Button)({
446+
// background: "#0099E6",
447+
// border: 0,
448+
// borderRadius: 3,
449+
// boxShadow: "0 0px 0px 2px #1a1a1a",
450+
// color: "white",
451+
// height: 24,
452+
// width: 40,
453+
// padding: "0 30px",
454+
// });
452455
export default StatePropsPanel;

app/src/components/bottom/CodePreview.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ const CodePreview: React.FC<{
3838

3939
const [state] = useContext(StateContext);
4040
const [, setDivHeight] = useState(0);
41-
const components = state.components;
4241
let currentComponent = state.components.find(
4342
(elem: Component) => elem.id === state.canvasFocus.componentId
4443
);
@@ -59,7 +58,7 @@ const CodePreview: React.FC<{
5958
type: 'CODE_PREVIEW_INPUT',
6059
payload: currentComponent.code
6160
});
62-
}, [currentComponent, components]); // Lillian added another dependency here to utilize useEffect
61+
}, [currentComponent, state.components]);
6362

6463
/**
6564
* Handler thats listens to changes in code editor

app/src/components/left/HTMLPanel.tsx

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import { makeStyles, styled } from '@material-ui/core/styles';
55
import {
66
Button,
77
InputLabel,
8-
TextField,
8+
// TextField,
99
} from "@material-ui/core";
10+
import TextField from '@mui/material/TextField';
1011

1112
/*
1213
DESCRIPTION: This is the bottom half of the left panel, starting from the 'HTML
@@ -163,8 +164,9 @@ const HTMLPanel = (props): JSX.Element => {
163164
Tag:
164165
</InputLabel>
165166
<TextField
166-
color={'primary'}
167-
variant={'outlined'}
167+
// label='Tag'
168+
color='primary'
169+
variant='outlined'
168170
type="text"
169171
name="Tag"
170172
value={tag}
@@ -189,8 +191,9 @@ const HTMLPanel = (props): JSX.Element => {
189191
Element Name:
190192
</InputLabel>
191193
<TextField
192-
color={'primary'}
193-
variant={'outlined'}
194+
// label='Element Name'
195+
color='primary'
196+
variant='outlined'
194197
type="text"
195198
name="Tag Name"
196199
value={name}
@@ -204,19 +207,20 @@ const HTMLPanel = (props): JSX.Element => {
204207
}
205208
}}
206209
/>
207-
208-
209210
{(!name.charAt(0).match(/[A-Za-z]/) || !alphanumeric(name) || name.trim() === '' || name.length > 10 || checkNameDupe(name))
210211
&& <span className={isThemeLight ? `${classes.errorMessage} ${classes.errorMessageLight}` : `${classes.errorMessage} ${classes.errorMessageDark}`}>
211212
<em>{errorMsg}</em>
212213
</span>}
213-
<AddElementButton
214+
<br></br>
215+
<Button
214216
className={isThemeLight ? `${classes.addElementButton} ${classes.lightThemeFontColor}` : `${classes.addElementButton} ${classes.darkThemeFontColor}`}
215217
id="submitButton"
216218
type="submit"
219+
color='primary'
220+
variant='contained'
217221
value="Add Element"
218222
>Add Element
219-
</AddElementButton>
223+
</Button>
220224
</form>
221225
</div>
222226
</div>
@@ -267,13 +271,14 @@ const useStyles = makeStyles({
267271
addElementButton: {
268272
backgroundColor: 'transparent',
269273
height: '40px',
270-
width: '105px',
274+
width: '200px',
271275
fontFamily: 'Roboto, Raleway, sans-serif',
272276
fontSize: '85%',
273277
textAlign: 'center',
274278
borderStyle: 'none',
275279
transition: '0.3s',
276280
borderRadius: '4px',
281+
alignSelf: 'center'
277282
},
278283
lightThemeFontColor: {
279284
color: '#155084',
@@ -288,10 +293,11 @@ const useStyles = makeStyles({
288293
}
289294
},
290295
errorMessage: {
296+
display: 'flex',
297+
alignSelf: 'center',
291298
fontSize:"11px",
292299
marginTop: "10px",
293300
width: "150px",
294-
marginLeft: "-15px"
295301
},
296302
errorMessageLight: {
297303
color: '#6B6B6B'
@@ -301,16 +307,17 @@ const useStyles = makeStyles({
301307
}
302308
});
303309

304-
const AddElementButton = styled(Button)({
305-
background: "#0099E6",
306-
border: 0,
307-
borderRadius: 3,
308-
boxShadow: "0 0px 0px 2px #1a1a1a",
309-
color: "white",
310-
height: 24,
311-
width: 160,
312-
padding: "0px 30px",
313-
alignSelf: 'center',
314-
});
310+
// changed to Button component to keep styling consistent
311+
// const AddElementButton = styled(Button)({
312+
// background: "#0099E6",
313+
// border: 0,
314+
// borderRadius: 3,
315+
// boxShadow: "0 0px 0px 2px #1a1a1a",
316+
// color: "white",
317+
// height: 24,
318+
// width: 160,
319+
// padding: "0px 30px",
320+
// alignSelf: 'center',
321+
// });
315322

316323
export default HTMLPanel;

app/src/components/main/Canvas.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ function Canvas(props): JSX.Element {
146146
childId: null
147147
}
148148
});
149+
// comment out below, not sure what the previous team want to do for this
149150
// } else {
150151
// alert('something is wrong');
151152
// able to duplicate a component in dev only does not work for prod
@@ -199,9 +200,6 @@ function Canvas(props): JSX.Element {
199200
// const canvasStyle = combineStyles(defaultCanvasStyle, currentComponent.style);
200201
const canvasStyle = combineStyles(defaultCanvasStyle, currentComponent.style);
201202
const darkCombinedCanvasStyle = combineStyles(darkCanvasStyle, currentComponent.style);
202-
// console.log('CURRENTCOMPONENT.CHILDREN : ', currentComponent.children)
203-
// console.log('STATE: ', state.components);
204-
// console.log('CURRENTCOMPONENT : ', currentComponent);
205203
return (
206204
<div className={'componentContainer'} ref={drop} style={props.isThemeLight ? canvasStyle : darkCombinedCanvasStyle} onClick={onClickHandler}>
207205
{renderChildren(currentComponent.children)}
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import React, { useRef, useState, useContext, useEffect } from 'react';
2-
import { Annotations } from '../../interfaces/Interfaces';
2+
import { DeleteButtons } from '../../interfaces/Interfaces';
33
import Modal from '@material-ui/core/Modal';
44
import StateContext from '../../context/context';
55

6-
function Annotation({ id, name }: Annotations) {
6+
function DeleteButton({ id, name }: DeleteButtons) {
77
const [state, dispatch] = useContext(StateContext);
88

9-
// -------------------------------- NEW CODE for DELETE BUTTONS, REPLACING ANNOTATIONS ---------------------------------------
10-
119
const deleteHTMLtype = (id: number) => {
1210
dispatch({
1311
type: 'DELETE CHILD',
@@ -18,18 +16,17 @@ function Annotation({ id, name }: Annotations) {
1816
return (
1917
<div style={{ padding: '1px', float: 'right' }}>
2018
<button
21-
className="annotate-button-empty" // NOTE: This className no longer accurate --> to update to delete button, same w/ Annotation export throughout
19+
className="delete-button-empty"
2220
id={'btn' + id}
2321
onClick={(event) => {
2422
event.stopPropagation();
2523
deleteHTMLtype(id);
2624
}}
27-
// ref={ref}
2825
>
2926
x
3027
</button>
3128
</div>
3229
);
3330
}
3431

35-
export default Annotation;
32+
export default DeleteButton;

app/src/components/main/DirectChildComponent.tsx

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
import React, { useContext, } from 'react';
2-
import {
3-
Component,
4-
ChildElement
5-
} from '../../interfaces/Interfaces';
1+
import React, { useContext } from 'react';
2+
import { Component, ChildElement } from '../../interfaces/Interfaces';
63
import { useDrag } from 'react-dnd';
74
import { ItemTypes } from '../../constants/ItemTypes';
85
import StateContext from '../../context/context';
9-
import Annotation from './Annotation'
6+
import DeleteButton from './DeleteButton';
107
import { combineStyles } from '../../helperFunctions/combineStyles';
118
import globalDefaultStyle from '../../public/styles/globalDefaultStyles';
129

13-
function DirectChildComponent({ childId, type, typeId, style, name }: ChildElement) {
10+
function DirectChildComponent({
11+
childId,
12+
type,
13+
typeId,
14+
style,
15+
name
16+
}: ChildElement) {
1417
const [state, dispatch] = useContext(StateContext);
1518

1619
// find the top-level component corresponding to this instance of the component
1720
// find the current component to render on the canvas
18-
1921
const referencedComponent: Component = state.components.find(
2022
(elem: Component) => elem.id === typeId
2123
);
@@ -29,7 +31,7 @@ function DirectChildComponent({ childId, type, typeId, style, name }: ChildEleme
2931
instanceType: type,
3032
instanceTypeId: typeId
3133
},
32-
collect: monitor => ({
34+
collect: (monitor) => ({
3335
isDragging: !!monitor.isDragging()
3436
})
3537
});
@@ -54,7 +56,7 @@ function DirectChildComponent({ childId, type, typeId, style, name }: ChildEleme
5456

5557
const combinedStyle = combineStyles(
5658
combineStyles(
57-
combineStyles(globalDefaultStyle, referencedComponent.style),
59+
combineStyles(globalDefaultStyle, referencedComponent.style)
5860
// style
5961
),
6062
interactiveStyle
@@ -69,12 +71,7 @@ function DirectChildComponent({ childId, type, typeId, style, name }: ChildEleme
6971
>
7072
<span>
7173
<strong>{name}</strong>
72-
73-
<Annotation
74-
id={childId}
75-
name={name}
76-
// annotations={annotations}
77-
/>
74+
<DeleteButton id={childId} name={name} />
7875
</span>
7976

8077
</div>

app/src/components/main/DirectChildHTML.tsx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,11 @@ import { ItemTypes } from '../../constants/ItemTypes';
55
import StateContext from '../../context/context';
66
import { combineStyles } from '../../helperFunctions/combineStyles';
77
import globalDefaultStyle from '../../public/styles/globalDefaultStyles';
8-
import Annotation from './Annotation';
8+
import DeleteButton from './DeleteButton';
99

1010
import { styleContext } from '../../containers/AppContainer';
1111

12-
function DirectChildHTML({
13-
childId,
14-
name,
15-
type,
16-
typeId,
17-
style,
18-
annotations
19-
}: ChildElement) {
12+
function DirectChildHTML({ childId, name, type, typeId, style }: ChildElement) {
2013
const [state, dispatch] = useContext(StateContext);
2114
const { isThemeLight } = useContext(styleContext);
2215

@@ -95,10 +88,9 @@ function DirectChildHTML({
9588
<strong style={{ color: isThemeLight ? 'black' : 'white' }}>
9689
{HTMLType.placeHolderShort}
9790
</strong>
98-
<Annotation
91+
<DeleteButton
9992
id={childId}
10093
name={name[0].toLowerCase() + name.slice(1)}
101-
annotations={annotations}
10294
/>
10395
</span>
10496
</div>

0 commit comments

Comments
 (0)