Skip to content

Commit 262b8f1

Browse files
Merge pull request #29 from buddhajjigae/style-feature
Style and Arrow feature update
2 parents bb78c77 + f99e87f commit 262b8f1

31 files changed

+127
-101
lines changed

app/electron/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ async function createWindow() {
7373
webPreferences: {
7474
zoomFactor: 0.7,
7575
// enable devtools when in development mode
76-
devTools: isDev,
76+
devTools: true,
7777
// crucial security feature - blocks rendering process from having access to node modules
7878
nodeIntegration: false,
7979
// web workers will not have access to node
@@ -91,6 +91,7 @@ async function createWindow() {
9191
nativeWindowOpen: true,
9292
},
9393
});
94+
win.webContents.openDevTools();
9495

9596
// Splash screen that appears while loading
9697
const hideSplashscreen = initSplashScreen({

app/src/Dashboard/styles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
}
7777

7878
.header {
79-
background-color: #186BB4;
79+
background-color: #0099E6;
8080
color: rgba(255, 255, 255, 0.897);
8181
width: 100%;
8282
position: relative;

app/src/components/bottom/BottomTabs.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import FormControl from '@material-ui/core/FormControl';
1515
import { styleContext } from '../../containers/AppContainer';
1616
import MenuItem from '@material-ui/core/MenuItem';
1717
import Select from '@material-ui/core/Select';
18+
import Arrow from '../main/Arrow';
1819

1920
const BottomTabs = (props): JSX.Element => {
2021
// state that controls which tab the user is on
@@ -25,12 +26,11 @@ const BottomTabs = (props): JSX.Element => {
2526
const [theme, setTheme] = useState('solarized_light');
2627
const { style } = useContext(styleContext);
2728

28-
2929
// breaks if handleChange is commented out
3030
const handleChange = (event: React.ChangeEvent, value: number) => {
3131
setTab(value);
3232
};
33-
// Allows users to toggle project between "next.js" and "Classic React"
33+
// Allows users to toggle project between "next.js" and "Classic React"
3434
// When a user changes the project type, the code of all components is rerendered
3535
const handleProjectChange = event => {
3636
const projectType = event.target.value;
@@ -42,7 +42,8 @@ const BottomTabs = (props): JSX.Element => {
4242
setTheme(e.target.value);
4343
};
4444

45-
// console.log("Editor Theme: ", theme);
45+
// Render's the highliting arrow feature that draws an arrow from the Canvas to the DemoRender
46+
Arrow.renderArrow(state.canvasFocus.childId);
4647

4748
return (
4849
<div className={classes.root} style={style}>
@@ -110,7 +111,7 @@ const BottomTabs = (props): JSX.Element => {
110111
const useStyles = makeStyles(theme => ({
111112
root: {
112113
flexGrow: 1,
113-
backgroundColor: '#186BB4',
114+
backgroundColor: '#003366',
114115
height: '100%',
115116
color: '#E8E8E8',
116117
boxShadow: '0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23)',
@@ -174,7 +175,7 @@ const useStyles = makeStyles(theme => ({
174175
marginBotton: '10px'
175176
},
176177
projectSelector: {
177-
backgroundColor: 'rgba(255,255,255,0.15)',
178+
backgroundColor: '#0099E6',
178179
color: 'white'
179180
}
180181
}));

app/src/components/bottom/CodePreview.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import 'ace-builds/src-noconflict/theme-monokai';
77
import 'ace-builds/src-noconflict/theme-github';
88
import 'ace-builds/src-noconflict/theme-solarized_dark';
99
import 'ace-builds/src-noconflict/theme-solarized_light';
10+
import 'ace-builds/src-noconflict/theme-monokai';
1011
import 'ace-builds/src-noconflict/theme-terminal';
1112
import { Component } from '../../interfaces/Interfaces';
1213
import useResizeObserver from '../../tree/useResizeObserver';
@@ -45,7 +46,7 @@ const CodePreview: React.FC<{
4546
>
4647
<AceEditor
4748
mode="javascript"
48-
theme="solarized_dark"
49+
theme="monokai"
4950
width="100%"
5051
height="100%"
5152
onChange={handleCodeSnipChange}

app/src/components/bottom/StylesEditor.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import 'ace-builds/src-noconflict/theme-github';
77
import 'ace-builds/src-noconflict/theme-solarized_dark';
88
import 'ace-builds/src-noconflict/theme-solarized_light';
99
import 'ace-builds/src-noconflict/theme-terminal';
10+
import 'ace-builds/src-noconflict/theme-monokai';
1011
import 'ace-builds/src-min-noconflict/ext-searchbox';
1112
import { Component } from '../../interfaces/Interfaces';
1213
import useResizeObserver from '../../tree/useResizeObserver';
@@ -77,7 +78,7 @@ const StylesEditor: React.FC<{
7778
>
7879
<AceEditor
7980
mode="css"
80-
theme={'solarized_dark'}
81+
theme={'monokai'}
8182
width="100%"
8283
height="100%"
8384
onChange={handleChange}

app/src/components/left/HTMLItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const useStyles = makeStyles({
3030
}
3131
},
3232
lightThemeFontColor: {
33-
color: '#186BB4'
33+
color: '#292929'
3434
},
3535
darkThemeFontColor: {
3636
color: '#fff'

app/src/components/left/HTMLPanel.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ const useStyles = makeStyles({
268268
borderRadius: '4px',
269269
},
270270
lightThemeFontColor: {
271-
color: '#186BB4'
271+
color: '#155084'
272272
},
273273
darkThemeFontColor: {
274274
color: '#ffffff'
@@ -288,10 +288,10 @@ const useStyles = makeStyles({
288288
});
289289

290290
const AddElementButton = styled(Button)({
291-
background: "#297ac2",
291+
background: "#0099E6",
292292
border: 0,
293293
borderRadius: 3,
294-
boxShadow: "0 2px 2px 2px #297ac2",
294+
boxShadow: "0 0px 0px 2px #1a1a1a",
295295
color: "white",
296296
height: 24,
297297
width: 160,

app/src/components/main/Annotation.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ function Annotation({
4343
const handleAnnoChange = (event) => {
4444
const { value } = event.target;
4545
if (value === '' || value === undefined) {
46-
ref.current.style.background = '#3ec1ac';
46+
ref.current.style.background = '#0CD34C';
4747
} else {
48-
ref.current.style.background = '#cc99ff';
48+
ref.current.style.background = '#D59DFF';
4949
}
5050
if (value != annotation) {
5151
setAnnotations(value);
@@ -87,7 +87,7 @@ function Annotation({
8787

8888
const body = (
8989
<div className='annotate-position'>
90-
<span className='annotate-textarea-header'>Notes for: {name} ( {id} )</span>
90+
<span className='annotate-textarea-header'> Notes for: {name} ( {id} )</span>
9191
<textarea className='annotate-textarea' id={id.toString()} onChange={handleAnnoChange}>{annotations}</textarea>
9292
</div>
9393
)

app/src/components/main/Arrow.tsx

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
const Arrow = {};
22

33
Arrow.renderArrow = (id : number) => {
4-
console.log("RENDER ARROW ID: ", id)
54
if(id != null) {
6-
let canvasEle = document.getElementById(`canv${id}`)//.offsetHeight;
5+
let canvasEle = document.getElementById(`canv${id}`)
76
let renderEle = document.getElementById(`rend${id}`)
87
if( canvasEle === null || renderEle === null) {
98
return;
109
} else {
11-
console.log("CANVAS ELE *******", canvasEle)
1210
let canvasElePosition = canvasEle.getBoundingClientRect();
1311
let renderElePosition = renderEle.getBoundingClientRect();
14-
console.log("POSITION *******" ,canvasElePosition)
1512
const canvasEleX = canvasElePosition.left + canvasElePosition.width;
1613
const canvasEleY = canvasElePosition.top + (canvasElePosition.height / 2);
1714
const renderEleX = renderElePosition.left;
@@ -21,10 +18,7 @@ Arrow.renderArrow = (id : number) => {
2118
}
2219
}
2320

24-
2521
Arrow.createLineElement = (x, y, length, angle) => {
26-
let line = document.createElement("div");
27-
line.setAttribute("class", "line");
2822
let styles = 'border: 1px solid black;'
2923
+ 'width: ' + length + 'px;'
3024
+ 'height: 0px;'
@@ -36,54 +30,41 @@ Arrow.createLineElement = (x, y, length, angle) => {
3630
+ 'position: absolute;'
3731
+ 'top: ' + y + 'px;'
3832
+ 'left: ' + x + 'px;';
33+
let line = document.createElement("div");
34+
line.setAttribute("class", "line");
3935
line.setAttribute('style', styles);
4036
return line;
4137
}
4238

4339
Arrow.createHeadElement = (x, y, length, angle) => {
44-
let head = document.createElement("div");
45-
head.setAttribute("class", "head");
46-
console.log('length', length)
47-
angle = angle;
48-
console.log("ANGLE >>>>>", angle)
49-
const negative = -angle;
50-
let styles = 'width: 14px;'
51-
+ 'height: 14px;'
40+
let styles = 'width: 13px;'
41+
+ 'height: 13px;'
5242
+ 'border: solid 2px;'
5343
+ 'border-radius: 50%;'
5444
+ 'z-index: 9999999999;'
55-
// + 'display: inline-block'
5645
+ 'background-color: #00FFFF;'
57-
+ 'border-color: #bbb;'
58-
//+ '-moz-transform: rotate(' + angle + 'rad);'
59-
// + '-webkit-transform: rotate(' + angle + 'rad);'
60-
//+ '-o-transform: rotate(' + angle + 'rad);'
46+
+ 'border-color: #bbb;'
6147
+ 'rotate: ' + angle + 'rad;'
62-
// + '-ms-transform: rotate(' + angle + 'rad);'
6348
+ 'position: absolute;'
64-
+ 'top: ' + -12 + 'px;'
65-
+ 'left: ' + 0 + (length - 10) + 'px;';
49+
+ 'top: ' + -6.5 + 'px;'
50+
+ 'left: ' + 0 + (length - 12) + 'px;';
51+
let head = document.createElement("div");
52+
head.setAttribute("class", "head");
6653
head.setAttribute('style', styles);
67-
console.log(head, "<<<<< HEAD")
6854
return head;
6955
}
7056

7157
Arrow.lineDraw = (x1, y1, x2, y2) => {
7258
let a = x1 - x2,
7359
b = y1 - y2,
7460
c = Math.sqrt(a * a + b * b);
75-
7661
let sx = (x1 + x2) / 2,
7762
sy = (y1 + y2) / 2;
78-
7963
let x = sx - c / 2,
8064
y = sy;
81-
8265
let alpha = Math.PI - Math.atan2(-b, a);
83-
8466
let line = Arrow.createLineElement(x, y, c, alpha);
8567
let head = Arrow.createHeadElement(x, y, c, alpha);
86-
console.log("HEAD HERE >>>>>>", head)
8768
Arrow.deleteLines();
8869
document.getElementsByClassName("main")[0].append(line);
8970
document.getElementsByClassName("line")[0].append(head);
@@ -92,7 +73,6 @@ Arrow.lineDraw = (x1, y1, x2, y2) => {
9273
Arrow.deleteLines = () => {
9374
let lineArray = document.getElementsByClassName("line");
9475
let headArray = document.getElementsByClassName("head");
95-
console.log("LINE ARRAY" , lineArray);
9676
for(const line of lineArray) {
9777
line.remove();
9878
}
@@ -101,4 +81,4 @@ Arrow.deleteLines = () => {
10181
}
10282
}
10383

104-
export default Arrow;
84+
export default Arrow;

app/src/components/main/Canvas.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ function Canvas() {
8585
const defaultCanvasStyle = {
8686
width: '100%',
8787
minHeight: '100%',
88-
backgroundColor: isOver ? 'lightyellow' : '#F5F5F5',
89-
backgroundImage: "url('https://www.transparenttextures.com/patterns/diagonal-noise.png')",
88+
backgroundColor: isOver ? '#FAFED1' : '#FBFBFB',
89+
//backgroundImage: "url('https://www.transparenttextures.com/patterns/diagonal-noise.png')",
9090
border: '1px solid #FBFBF2',
91-
borderStyle: isOver ? 'dotted' : 'solid'
91+
borderStyle: isOver ? 'dotted' : 'solid',
9292
};
9393
// Combine the default styles of the canvas with the custom styles set by the user for that component
9494
// The render children function renders all direct children of a given component

app/src/components/main/DemoRender.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const DemoRender = (props): JSX.Element => {
1212
const [state, dispatch] = useContext(StateContext);
1313
const demoContainerStyle = {
1414
width: '100%',
15-
backgroundColor: 'lightgrey',
15+
backgroundColor: '#FBFBFB',
1616
border: '2px Solid grey',
1717
};
1818

app/src/components/main/DirectChildComponent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function DirectChildComponent({ childId, type, typeId, style }: ChildElement) {
5050
const interactiveStyle = {
5151
border:
5252
state.canvasFocus.childId === childId
53-
? '3px solid #a7cced'
53+
? '3px solid #186BB4'
5454
: '1px Solid grey',
5555
boxShadow:
5656
state.canvasFocus.childId === childId ? '1px 1px 3px #a7cced' : ''

app/src/components/main/DirectChildHTML.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function DirectChildHTML({
5959
const interactiveStyle = {
6060
border:
6161
state.canvasFocus.childId === childId
62-
? '3px solid #a7cced'
62+
? '3px solid #186BB4'
6363
: '1px solid grey'
6464
};
6565

app/src/components/main/DirectChildHTMLNestable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const snapShotFunc = () => {
120120
const interactiveStyle = {
121121
border:
122122
state.canvasFocus.childId === childId
123-
? '1px solid #186BB4'
123+
? '3px solid #186BB4'
124124
: '1px solid grey',
125125
};
126126

app/src/components/right/ComponentDrag.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const useStyles = makeStyles({
9797
wordWrap: 'break-word',
9898
},
9999
lightThemeFontColor: {
100-
color: '#186BB4'
100+
color: '#155084'
101101
},
102102
darkThemeFontColor: {
103103
color: '#fff'

app/src/components/right/ComponentPanel.tsx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,16 @@ const ComponentPanel = ({isThemeLight}): JSX.Element => {
179179
/>
180180
</div>
181181
</div>
182-
<CreateButton
183-
className={isThemeLight ? `${classes.addComponentButton} ${classes.lightThemeFontColor}` : `${classes.addComponentButton} ${classes.darkThemeFontColor}`}
184-
id="addComponentButton"
185-
onClick={handleNameSubmit}
186-
>
187-
Create
188-
</CreateButton>
182+
<div>
183+
<br/>
184+
<CreateButton
185+
className={isThemeLight ? `${classes.addComponentButton} ${classes.lightThemeFontColor}` : `${classes.addComponentButton} ${classes.darkThemeFontColor}`}
186+
id="addComponentButton"
187+
onClick={handleNameSubmit}
188+
>
189+
Create
190+
</CreateButton>
191+
</div>
189192
</div>
190193
</div>
191194
);
@@ -218,7 +221,7 @@ const useStyles = makeStyles({
218221
flexDirection:'column',
219222
alignItems:'center',
220223
flexGrow : 1,
221-
backgroundColor: '#fafaf6',
224+
backgroundColor: '#F9F9F9',
222225
color: '#000000',
223226
},
224227
addComponentWrapper: {
@@ -264,18 +267,18 @@ const useStyles = makeStyles({
264267
fontSize: '0.85rem'
265268
},
266269
lightThemeFontColor: {
267-
color: '#186BB4'
270+
color: '#155084'
268271
},
269272
darkThemeFontColor: {
270273
color: '#fff'
271274
}
272275
});
273276

274277
const CreateButton = styled(Button)({
275-
background: "#297ac2",
278+
background: "#0099E6",
276279
border: 0,
277280
borderRadius: 3,
278-
boxShadow: "0 2px 2px 2px #297ac2",
281+
boxShadow: "0 0px 0px 2px #1a1a1a",
279282
color: "white",
280283
height: 24,
281284
width: 60,

app/src/components/right/ComponentPanelItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,13 @@ const ComponentPanelItem: React.FC<{
7171
ref={drag}
7272
xs={8}
7373
style={{
74-
color: '#186BB4',
74+
color: '#262626',
7575
backgroundColor: 'transparent',
7676
border: root
7777
? '2px dotted #186BB4'
7878
: '2px solid #186BB4',
7979
borderRadius: '4px',
80+
borderColor: '#000000',
8081
}}
8182
>
8283
<div className="compPanelItem" onClick={handleClick}>

0 commit comments

Comments
 (0)