Skip to content

Commit 08f540e

Browse files
committed
Improved UI of left panel's add component and project type inputs. Simplified options in modal
1 parent b13d11c commit 08f540e

File tree

3 files changed

+65
-50
lines changed

3 files changed

+65
-50
lines changed

app/src/components/left/ComponentPanel.tsx

Lines changed: 52 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,28 @@ const useStyles = makeStyles({
2727
textAlign: 'center',
2828
display: 'flex',
2929
alignItems: 'center',
30-
justifyContent: 'center',
31-
paddingLeft: '35px',
30+
justifyContent: 'space-between',
31+
// paddingLeft: '35px',
3232
marginBottom: '15px'
3333
},
34+
addComponentWrapper: {
35+
border: '1px solid rgba(70,131,83)',
36+
padding: '20px',
37+
margin: '20px'
38+
},
3439
rootCheckBox: {},
3540
rootCheckBoxLabel: {
3641
color: 'white'
3742
},
3843
projectTypeWrapper: {
39-
paddingLeft: '35px',
40-
marginBottom: '15px'
44+
paddingLeft: '20px',
45+
paddingRight: '20px',
46+
marginBottom: '15px',
47+
width: '100%'
4148
},
4249
projectSelector: {
4350
backgroundColor: 'rgba(255,255,255,0.15)',
44-
width: '100%',
51+
width: '317px',
4552
color: '#fff'
4653
},
4754
panelWrapper: {
@@ -84,9 +91,10 @@ const useStyles = makeStyles({
8491
},
8592
button: {
8693
fontSize: '1rem',
87-
height: '70px',
94+
height: '40px',
8895
maginTop: '10px',
89-
border: '1px solid rgba(70,131,83)',
96+
width: '100%',
97+
// border: '1px solid rgba(70,131,83)',
9098
backgroundColor: 'rgba(1,212,109,0.1)'
9199
},
92100
rootToggle: {
@@ -193,8 +201,8 @@ const ComponentPanel = (): JSX.Element => {
193201
<div className={classes.projectTypeWrapper}>
194202
<FormControl>
195203
{/* <InputLabel id="project-type-label" className={classes.inputLabel}>
196-
Project Type
197-
</InputLabel> */}
204+
Project Type
205+
</InputLabel> */}
198206
<Select
199207
variant="outlined"
200208
labelId="project-type-label"
@@ -208,35 +216,42 @@ const ComponentPanel = (): JSX.Element => {
208216
</Select>
209217
</FormControl>
210218
</div>
211-
<div className={classes.inputWrapper}>
212-
<TextField
213-
color={'primary'}
214-
label="Component Name"
215-
variant="outlined"
216-
className={classes.inputField}
217-
InputProps={{ className: classes.input }}
218-
InputLabelProps={{ className: classes.inputLabel }}
219-
value={compName}
220-
error={errorStatus}
221-
helperText={errorStatus ? errorMsg : ''}
222-
onChange={handleNameInput}
223-
/>
224-
<div className={classes.btnGroup}>
225-
<FormControlLabel
226-
value="top"
227-
control={<Checkbox color="primary" onChange={toggleRootStatus} />}
228-
label={state.projectType === 'Next.js' ? 'Page' : 'Root'}
229-
className={classes.rootCheckBoxLabel}
230-
labelPlacement="top"
231-
/>
219+
220+
<div className={classes.addComponentWrapper}>
221+
<div>
222+
<div className={classes.inputWrapper}>
223+
<TextField
224+
color={'primary'}
225+
label="Component Name"
226+
variant="outlined"
227+
className={classes.inputField}
228+
InputProps={{ className: classes.input }}
229+
InputLabelProps={{ className: classes.inputLabel }}
230+
value={compName}
231+
error={errorStatus}
232+
helperText={errorStatus ? errorMsg : ''}
233+
onChange={handleNameInput}
234+
/>
235+
<div className={classes.btnGroup}>
236+
<FormControlLabel
237+
value="top"
238+
control={
239+
<Checkbox color="primary" onChange={toggleRootStatus} />
240+
}
241+
label={state.projectType === 'Next.js' ? 'Page' : 'Root'}
242+
className={classes.rootCheckBoxLabel}
243+
labelPlacement="top"
244+
/>
245+
</div>
246+
</div>
247+
<Button
248+
className={classes.button}
249+
color="primary"
250+
onClick={handleNameSubmit}
251+
>
252+
ADD
253+
</Button>
232254
</div>
233-
<Button
234-
className={classes.button}
235-
color="primary"
236-
onClick={handleNameSubmit}
237-
>
238-
ADD
239-
</Button>
240255
</div>
241256
<div className={classes.panelWrapperList}>
242257
<h4>{state.projectType === 'Next.js' ? 'Pages' : 'Root components'}</h4>

app/src/containers/LeftContainer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ const LeftContainer = (): JSX.Element => {
5353
// genOption = 1 --> export an entire project w/ webpack, server, etc.
5454
const genOptions: string[] = [
5555
'Export components',
56-
'Export components with application files',
57-
'Export project as Next.js application'
56+
'Export components with application files'
5857
];
5958
// const [genOption, setGenOption] = useState(1);
6059
let genOption = 0;
@@ -128,6 +127,7 @@ const LeftContainer = (): JSX.Element => {
128127
path,
129128
'NEW PROJECT',
130129
genOption,
130+
state.projectType,
131131
state.components,
132132
state.rootComponents
133133
);

app/src/utils/exportProject.util.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,31 @@ import createApplicationUtil from './createApplication.util';
22
import createNextApp from './createNextApp.util';
33
import createFiles from './createFiles.util';
44

5-
65
const exportProject = (
76
path: string,
87
appName: string,
98
genOption: number,
9+
projectType: string,
1010
components: any,
1111
rootComponents: number[]
1212
) => {
13-
if (genOption === 1) {
14-
console.log('in exportProject, genOption 1')
13+
if (genOption === 1 && projectType === 'Classic React') {
14+
console.log('in exportProject, genOption 1');
1515
createApplicationUtil({ path, appName, components })
1616
.then(() => {
1717
console.log('CreateApplicationUtil has finished');
1818
})
1919
.catch(err => console.log(err));
2020
} else if (genOption === 0) {
21-
console.log('in exportProject, genOption 0')
21+
console.log('in exportProject, genOption 0');
2222
createFiles(components, path, appName, false);
23-
} else if (genOption === 2) {
24-
console.log('in exportProject, genOption 2')
25-
createNextApp({ path, appName, components, rootComponents})
26-
.then(() => {
27-
console.log('CreateNextApp has finished');
28-
})
29-
.catch(err => console.log(err));
23+
} else if (genOption === 1 && projectType === 'Next.js') {
24+
console.log('in exportProject, genOption 2');
25+
createNextApp({ path, appName, components, rootComponents })
26+
.then(() => {
27+
console.log('CreateNextApp has finished');
28+
})
29+
.catch(err => console.log(err));
3030
}
3131
};
3232

0 commit comments

Comments
 (0)