Skip to content

Commit 8b4f168

Browse files
Merge pull request #54 from ChristianEdwardPadilla/development
merged from styling changes with export working
2 parents 48143e6 + 2c7595f commit 8b4f168

File tree

6 files changed

+60
-62
lines changed

6 files changed

+60
-62
lines changed

src/actions/components.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ export const changeComponentFocusChild = ({ componentId, childId }) => (dispatch
145145
};
146146

147147
export const exportFiles = ({ components, path }) => (dispatch) => {
148+
// this dispatch sets the global state property 'loading' to true until the createFiles call resolves below
148149
dispatch({
149150
type: EXPORT_FILES,
150151
});
@@ -183,7 +184,7 @@ export const createApplication = ({
183184
path,
184185
components = [],
185186
genOption,
186-
appName = 'proto_app',
187+
appName = 'reactype_app',
187188
repoUrl,
188189
}) => (dispatch) => {
189190
if (genOption === 0) {

src/components/HTMLComponentPanel.jsx

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
import React, { Component } from "react";
2-
import { connect } from "react-redux";
3-
import { compose } from "redux";
4-
import { withStyles } from "@material-ui/core/styles";
5-
import TextField from "@material-ui/core/TextField";
6-
import IconButton from "@material-ui/core/IconButton";
7-
import ImageIcon from "@material-ui/icons/Image";
8-
import FormIcon from "@material-ui/icons/Description";
9-
import ButtonIcon from "@material-ui/icons/EditAttributes";
10-
import LinkIcon from "@material-ui/icons/Link";
11-
import ListIcon from "@material-ui/icons/List";
12-
import ParagraphIcon from "@material-ui/icons/LocalParking";
13-
import theme from "../components/theme.ts";
1+
import React, { Component } from 'react';
2+
import { connect } from 'react-redux';
3+
import { compose } from 'redux';
4+
import { withStyles } from '@material-ui/core/styles';
5+
import TextField from '@material-ui/core/TextField';
6+
import IconButton from '@material-ui/core/IconButton';
7+
import ImageIcon from '@material-ui/icons/Image';
8+
import FormIcon from '@material-ui/icons/Description';
9+
import ButtonIcon from '@material-ui/icons/EditAttributes';
10+
import LinkIcon from '@material-ui/icons/Link';
11+
import ListIcon from '@material-ui/icons/List';
12+
import ParagraphIcon from '@material-ui/icons/LocalParking';
1413
import Typography from '@material-ui/core/Typography';
15-
import Grid from "@material-ui/core/Grid";
16-
import Paper from "@material-ui/core/Paper";
14+
import Grid from '@material-ui/core/Grid';
15+
import Paper from '@material-ui/core/Paper';
16+
import theme from './theme.ts';
1717
// import {HTMLelements,getSize} from "../utils/htmlElements.util";
1818

1919
class HTMLComponentPanel extends Component {
2020
state = {
21-
HtmlComponentName: ""
21+
HtmlComponentName: '',
2222
};
2323

24-
handleChange = event => {
24+
handleChange = (event) => {
2525
this.setState({
26-
HtmlComponentName: event.target.value
26+
HtmlComponentName: event.target.value,
2727
});
2828
};
2929

30-
handleCreateHTMLChild = type => {
30+
handleCreateHTMLChild = (type) => {
3131
this.props.addChild({ title: type, childType: type, HTMLInfo: {} });
3232
};
3333

@@ -60,7 +60,7 @@ class HTMLComponentPanel extends Component {
6060
<IconButton
6161
aria-label="Image"
6262
onClick={() => {
63-
this.handleCreateHTMLChild("Image");
63+
this.handleCreateHTMLChild('Image');
6464
}}
6565

6666
// onClick={() => {
@@ -75,7 +75,7 @@ class HTMLComponentPanel extends Component {
7575
<IconButton
7676
aria-label="Form"
7777
onClick={() => {
78-
this.handleCreateHTMLChild("Form");
78+
this.handleCreateHTMLChild('Form');
7979
}}
8080
>
8181
<FormIcon />
@@ -85,7 +85,7 @@ class HTMLComponentPanel extends Component {
8585
<IconButton
8686
aria-label="Button"
8787
onClick={() => {
88-
this.handleCreateHTMLChild("Button");
88+
this.handleCreateHTMLChild('Button');
8989
}}
9090
>
9191
<ButtonIcon />
@@ -95,7 +95,7 @@ class HTMLComponentPanel extends Component {
9595
<IconButton
9696
aria-label="Link"
9797
onClick={() => {
98-
this.handleCreateHTMLChild("Link");
98+
this.handleCreateHTMLChild('Link');
9999
}}
100100
>
101101
<LinkIcon />
@@ -105,7 +105,7 @@ class HTMLComponentPanel extends Component {
105105
<IconButton
106106
aria-label="List"
107107
onClick={() => {
108-
this.handleCreateHTMLChild("List");
108+
this.handleCreateHTMLChild('List');
109109
}}
110110
>
111111
<ListIcon />
@@ -115,7 +115,7 @@ class HTMLComponentPanel extends Component {
115115
<IconButton
116116
aria-label="Paragraph"
117117
onClick={() => {
118-
this.handleCreateHTMLChild("Paragraph");
118+
this.handleCreateHTMLChild('Paragraph');
119119
}}
120120
>
121121
<ParagraphIcon />
@@ -130,20 +130,20 @@ class HTMLComponentPanel extends Component {
130130
function styles(theme) {
131131
return {
132132
htmlPanel: {
133-
width: "100%",
134-
height: "33%",
133+
width: '100%',
134+
height: '33%',
135135
// flexGrow: 1,
136-
backgroundColor: "#333333",
136+
backgroundColor: '#333333',
137137
// position: "absolute",
138138
// marginTop: 10,
139-
bottom: "0px"
139+
bottom: '0px',
140140
// // marginRight: "20px",
141141
// // marginLeft: "20px",
142142
// // marginBottom: "20px",
143143
// bottom: "0px",
144144
// left: "0px",
145145
// right: "0px"
146-
}
146+
},
147147
};
148148
}
149149

src/containers/AppContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { MuiThemeProvider } from '@material-ui/core/styles';
55
import LinearProgress from '@material-ui/core/LinearProgress';
66
import LeftContainer from './LeftContainer.jsx';
77
import MainContainer from './MainContainer.jsx';
8-
import RightContainer from './RightContainer.jsx';
8+
// import RightContainer from './RightContainer.jsx';
99
import convertIdsToObjs from '../utils/convertIdsToObjs.util';
1010
import theme from '../components/theme.ts';
1111
import { loadInitData } from '../actions/components';

src/containers/MainContainer.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,4 +323,4 @@ class MainContainer extends Component {
323323
export default connect(
324324
mapStateToProps,
325325
mapDispatchToProps,
326-
)(MainContainer);
326+
)(MainContainer);

src/utils/createApplication.util.js

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,34 @@ function createIndexHtml() {
2727
</body>
2828
</html>
2929
`;
30-
fs.writeFile(fileName, format(data, {
31-
singleQuote: true,
32-
trailingComma: 'es5',
33-
bracketSpacing: true,
34-
jsxBracketSameLine: true,
35-
parser: 'babel',
36-
}),
37-
(err) => {
38-
if (err) {
39-
console.log('index.html error:', err.message);
40-
} else {
41-
console.log('index.html written successfully');
42-
}
43-
});
30+
fs.writeFile(
31+
fileName,
32+
format(data, {
33+
singleQuote: true,
34+
trailingComma: 'es5',
35+
bracketSpacing: true,
36+
jsxBracketSameLine: true,
37+
parser: 'babel',
38+
}),
39+
(err) => {
40+
if (err) {
41+
console.log('index.html error:', err.message);
42+
} else {
43+
console.log('index.html written successfully');
44+
}
45+
},
46+
);
4447
}
4548

46-
async function createApplicationUtil({path, appName, genOption, repoUrl}) {
49+
async function createApplicationUtil({
50+
path, appName, genOption, repoUrl,
51+
}) {
4752
if (genOption === 1) {
4853
await createIndexHtml();
4954
}
5055
}
5156
export default createApplicationUtil;
5257

53-
54-
55-
5658
// async function createApplicationUtil({
5759
// path, appName, genOption, repoUrl,
5860
// }) {
@@ -65,15 +67,9 @@ export default createApplicationUtil;
6567
// await execFile('touch', '.babelrc', { cwd: path }),
6668
// ];
6769
// }
68-
// return repoUrl ? execFile('git', ['clone', repoUrl, appName], { cwd: path }) : null;
70+
// return repoUrl ? execFile('git', ['clone', repoUrl, appName], { cwd: path }) : null;
6971
// }
7072

71-
72-
73-
74-
75-
76-
7773
// import util from 'util';
7874

7975
// const execFile = util.promisify(require('child_process').execFile);
@@ -83,7 +79,6 @@ export default createApplicationUtil;
8379
// 'Export into existing project.', 'Export with starter repo', 'Export with create-react-app.'
8480
// ];
8581

86-
8782
// async function createApplicationUtil({
8883
// path, appName, genOption, repoUrl,
8984
// }) {
@@ -96,4 +91,4 @@ export default createApplicationUtil;
9691
// return repoUrl ? execFile('git', ['clone', repoUrl, appName], { cwd: path }) : null;
9792
// }
9893

99-
// export default createApplicationUtil;
94+
// export default createApplicationUtil;

src/utils/createFiles.util.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ const createFiles = (data, path) => {
1616
const promises = [];
1717
data.forEach((component) => {
1818
const newPromise = new Promise((resolve, reject) => {
19-
fs.writeFile(`${dir}/${component.title}.tsx`,
19+
fs.writeFile(
20+
`${dir}/${component.title}.tsx`,
2021
format(componentRender(component, data), {
2122
singleQuote: true,
2223
trailingComma: 'es5',
@@ -27,7 +28,8 @@ const createFiles = (data, path) => {
2728
(err) => {
2829
if (err) return reject(err.message);
2930
return resolve(path);
30-
});
31+
},
32+
);
3133
});
3234

3335
promises.push(newPromise);

0 commit comments

Comments
 (0)