Skip to content

Commit ade12be

Browse files
committed
styling changes
2 parents a062161 + b1e5d7c commit ade12be

15 files changed

+819
-709
lines changed

src/actions/components.js

Lines changed: 51 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,21 @@ import {
2525
DELETE_PROP,
2626
ADD_PROP,
2727
DELETE_ALL_DATA,
28-
CHANGE_IMAGE_PATH
29-
} from "../actionTypes/index";
28+
CHANGE_IMAGE_PATH,
29+
} from '../actionTypes/index';
3030

31-
import { loadState } from "../localStorage";
31+
import { loadState } from '../localStorage';
3232

3333
import createFiles from '../utils/createFiles.util';
34-
import createApplicationUtil from '../utils/createApplication.util'
35-
36-
export const loadInitData = () => dispatch => {
37-
loadState().then(data =>
38-
dispatch({
39-
type: LOAD_INIT_DATA,
40-
payload: {
41-
data: data ? data.workspace : {}
42-
}
43-
})
44-
);
34+
import createApplicationUtil from '../utils/createApplication.util';
35+
36+
export const loadInitData = () => (dispatch) => {
37+
loadState().then(data => dispatch({
38+
type: LOAD_INIT_DATA,
39+
payload: {
40+
data: data ? data.workspace : {},
41+
},
42+
}));
4543
};
4644

4745
// export const updateChildren = ({ parentIds, childIndex, childId }) => ({
@@ -62,47 +60,39 @@ export const loadInitData = () => dispatch => {
6260
// },
6361
// });
6462

65-
export const addComponent = ({ title }) => dispatch => {
63+
export const addComponent = ({ title }) => (dispatch) => {
6664
dispatch({ type: ADD_COMPONENT, payload: { title } });
6765
};
6866

69-
export const addChild = ({ title, childType, HTMLInfo }) => dispatch => {
67+
export const addChild = ({ title, childType, HTMLInfo }) => (dispatch) => {
7068
dispatch({ type: ADD_CHILD, payload: { title, childType, HTMLInfo } });
7169
};
7270

73-
export const deleteChild = ({}) => dispatch => {
71+
export const deleteChild = ({}) => (dispatch) => {
7472
// with no payload, it will delete focusd child
7573
dispatch({ type: DELETE_CHILD, payload: {} });
7674
};
7775

78-
export const deleteComponent = ({
79-
componentId,
80-
stateComponents
81-
}) => dispatch => {
82-
console.log(
83-
"Hello from component.js delete component.componentId= ",
84-
componentId
85-
);
76+
export const deleteComponent = ({ componentId, stateComponents }) => (dispatch) => {
77+
console.log('Hello from component.js delete component.componentId= ', componentId);
8678

8779
// find all places where the "to be delted" is a child and do what u gotta do
88-
stateComponents.forEach(parent => {
89-
parent.childrenArray
90-
.filter(child => child.childComponentId == componentId)
91-
.forEach(child => {
92-
// console.log(`Should delete ${child.childId} from component id:${parent.id} ${parent.title}`)
93-
dispatch({
94-
type: DELETE_CHILD,
95-
payload: {
96-
parentId: parent.id,
97-
childId: child.childId,
98-
calledFromDeleteComponent: true
99-
}
100-
});
80+
stateComponents.forEach((parent) => {
81+
parent.childrenArray.filter(child => child.childComponentId == componentId).forEach((child) => {
82+
// console.log(`Should delete ${child.childId} from component id:${parent.id} ${parent.title}`)
83+
dispatch({
84+
type: DELETE_CHILD,
85+
payload: {
86+
parentId: parent.id,
87+
childId: child.childId,
88+
calledFromDeleteComponent: true,
89+
},
10190
});
91+
});
10292
});
10393

10494
// change focus to APp
105-
dispatch({ type: CHANGE_FOCUS_COMPONENT, payload: { title: "App" } });
95+
dispatch({ type: CHANGE_FOCUS_COMPONENT, payload: { title: 'App' } });
10696
// after taking care of the children delete the component
10797
dispatch({ type: DELETE_COMPONENT, payload: { componentId } });
10898
};
@@ -138,22 +128,19 @@ export const deleteComponent = ({
138128
// dispatch({ type: SET_SELECTABLE_PARENTS });
139129
// };
140130

141-
export const changeFocusComponent = ({ title }) => dispatch => {
131+
export const changeFocusComponent = ({ title }) => (dispatch) => {
142132
dispatch({ type: CHANGE_FOCUS_COMPONENT, payload: { title } });
143133
};
144134

145135
// make sure childId is being sent in
146-
export const changeFocusChild = ({ title, childId }) => dispatch => {
136+
export const changeFocusChild = ({ title, childId }) => (dispatch) => {
147137
dispatch({ type: CHANGE_FOCUS_CHILD, payload: { title, childId } });
148138
};
149139

150-
export const changeComponentFocusChild = ({
151-
componentId,
152-
childId
153-
}) => dispatch => {
140+
export const changeComponentFocusChild = ({ componentId, childId }) => (dispatch) => {
154141
dispatch({
155142
type: CHANGE_COMPONENT_FOCUS_CHILD,
156-
payload: { componentId, childId }
143+
payload: { componentId, childId },
157144
});
158145
};
159146

@@ -175,27 +162,29 @@ export const exportFiles = ({ components, path }) => (dispatch) => {
175162

176163
export const handleClose = () => ({
177164
type: HANDLE_CLOSE,
178-
payload: false
165+
payload: false,
179166
});
180167

181-
export const handleTransform = (
182-
componentId,
183-
childId,
184-
{ x, y, width, height }
185-
) => ({
168+
export const handleTransform = (componentId, childId, {
169+
x, y, width, height,
170+
}) => ({
186171
type: HANDLE_TRANSFORM,
187172
payload: {
188173
componentId,
189174
childId,
190175
x,
191176
y,
192177
width,
193-
height
194-
}
178+
height,
179+
},
195180
});
196181

197182
export const createApplication = ({
198-
path, components = [], genOption, appName = 'proto_app', repoUrl,
183+
path,
184+
components = [],
185+
genOption,
186+
appName = 'proto_app',
187+
repoUrl,
199188
}) => (dispatch) => {
200189
if (genOption === 0) {
201190
dispatch(exportFiles({ path, components }));
@@ -204,7 +193,10 @@ export const createApplication = ({
204193
type: CREATE_APPLICATION,
205194
});
206195
createApplicationUtil({
207-
path, appName, genOption, repoUrl,
196+
path,
197+
appName,
198+
genOption,
199+
repoUrl,
208200
})
209201
.then(() => {
210202
dispatch({
@@ -221,18 +213,18 @@ export const createApplication = ({
221213

222214
export const openExpansionPanel = component => ({
223215
type: OPEN_EXPANSION_PANEL,
224-
payload: { component }
216+
payload: { component },
225217
});
226218

227219
// export const deleteAllData = () => ({
228220
// type: DELETE_ALL_DATA,
229221
// });
230222

231-
export const deleteProp = propId => dispatch => {
223+
export const deleteProp = propId => (dispatch) => {
232224
dispatch({ type: DELETE_PROP, payload: propId });
233225
};
234226

235227
export const addProp = prop => ({
236228
type: ADD_PROP,
237-
payload: { ...prop }
229+
payload: { ...prop },
238230
});

src/components/MainContainerHeader.jsx renamed to src/components/ApplicationActions.jsx

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,52 @@
1-
import React from 'react';
1+
import React from "react";
22
// import PropTypes from 'prop-types';
3-
import Button from '@material-ui/core/Button';
4-
import ZoomInIcon from '@material-ui/icons/ZoomIn';
5-
import ZoomOutIcon from '@material-ui/icons/ZoomOut';
6-
import ImageSearchIcon from '@material-ui/icons/ImageSearch';
7-
import OpenWithIcon from '@material-ui/icons/OpenWith';
8-
import KeyboardArrowLeftIcon from '@material-ui/icons/KeyboardArrowLeft';
9-
import KeyboardArrowRightIcon from '@material-ui/icons/KeyboardArrowRight';
10-
import DeleteOutlineIcon from '@material-ui/icons/DeleteOutline';
11-
import GetAppIcon from '@material-ui/icons/GetApp';
12-
import { withStyles } from '@material-ui/core/styles';
13-
import Tooltip from '@material-ui/core/Tooltip';
3+
import Button from "@material-ui/core/Button";
4+
import ZoomInIcon from "@material-ui/icons/ZoomIn";
5+
import ZoomOutIcon from "@material-ui/icons/ZoomOut";
6+
import ImageSearchIcon from "@material-ui/icons/ImageSearch";
7+
import OpenWithIcon from "@material-ui/icons/OpenWith";
8+
import KeyboardArrowLeftIcon from "@material-ui/icons/KeyboardArrowLeft";
9+
import KeyboardArrowRightIcon from "@material-ui/icons/KeyboardArrowRight";
10+
import DeleteOutlineIcon from "@material-ui/icons/DeleteOutline";
11+
import GetAppIcon from "@material-ui/icons/GetApp";
12+
import { withStyles } from "@material-ui/core/styles";
13+
import Tooltip from "@material-ui/core/Tooltip";
1414

1515
const styles = () => ({
1616
iconSmall: {
17-
fontSize: 10,
17+
fontSize: 10
1818
},
1919
button: {
2020
// borderRight: '1px solid grey',
21-
borderRadius: '0px',
22-
backgroundColor: '#212121',
21+
borderRadius: "0px",
22+
backgroundColor: "#212121",
2323

24-
'&:hover > span > svg': {
25-
color: '#1de9b6',
26-
transition: 'all .2s ease',
24+
"&:hover > span > svg": {
25+
color: "#1de9b6",
26+
transition: "all .2s ease"
2727
},
28-
'&:hover': {
29-
backgroundColor: '#212121',
28+
"&:hover": {
29+
backgroundColor: "#212121"
3030
},
31-
'&:disabled': {
32-
backgroundColor: '#424242',
31+
"&:disabled": {
32+
backgroundColor: "#424242"
3333
},
3434

35-
'&:disabled > span > svg': {
36-
color: '#eee',
37-
opacity: '0.3',
38-
},
35+
"&:disabled > span > svg": {
36+
color: "#eee",
37+
opacity: "0.3"
38+
}
3939
},
4040
light: {
41-
color: '#eee',
41+
color: "#eee"
4242
// opacity: '0.7',
4343
},
4444
dark: {
45-
color: '#1de9b6',
46-
},
45+
color: "#1de9b6"
46+
}
4747
});
4848

49-
50-
const MainContainerHeader = (props) => {
49+
const MainContainerHeader = props => {
5150
const {
5251
classes,
5352
image,
@@ -56,7 +55,7 @@ const MainContainerHeader = (props) => {
5655
totalComponents,
5756
showGenerateAppModal,
5857
collapseColumn,
59-
rightColumnOpen,
58+
rightColumnOpen
6059
} = props;
6160

6261
return (
@@ -74,14 +73,18 @@ const MainContainerHeader = (props) => {
7473
</Button>
7574
</div>
7675
</Tooltip>
77-
<Tooltip title={image ? 'update image' : 'upload image'}>
76+
<Tooltip title={image ? "update image" : "upload image"}>
7877
<div>
79-
<Button color="default" className={classes.button} onClick={updateImage}>
78+
<Button
79+
color="default"
80+
className={classes.button}
81+
onClick={updateImage}
82+
>
8083
<ImageSearchIcon className={classes.light} />
8184
</Button>
8285
</div>
8386
</Tooltip>
84-
<Tooltip title={'export'}>
87+
<Tooltip title={"export"}>
8588
<div>
8689
<Button
8790
color="default"

0 commit comments

Comments
 (0)