Skip to content

Commit 24ec514

Browse files
committed
improved sidepanel
1 parent 58fde10 commit 24ec514

File tree

8 files changed

+115
-72
lines changed

8 files changed

+115
-72
lines changed

app/src/components/left/ContentArea.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const TabPanel: React.FC<TabPanelProps> = ({ children, value, index }) => {
1414
return <Box hidden={value !== index}>{value === index && children}</Box>;
1515
};
1616

17-
function ContentArea({ value }: { value: number | null }) {
17+
const ContentArea: React.FC<{ value: number | null }> = ({ value }) => {
1818
if (value === null) {
1919
return null;
2020
}
@@ -37,6 +37,6 @@ function ContentArea({ value }: { value: number | null }) {
3737
</div>
3838
</div>
3939
);
40-
}
40+
};
4141

4242
export default ContentArea;

app/src/components/left/DragDropPanel.tsx

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,14 @@ const DragDropPanel = (props): JSX.Element => {
3838
return (
3939
<div className={`${!isDarkMode ? 'HTMLItems' : 'HTMLItemsDark'}`}>
4040
<div id="HTMLItemsTopHalf">
41+
<h3 style={{ color: !isDarkMode ? '#C6C6C6' : '#fff' }}>
42+
HTML Elements
43+
</h3>
4144
<Grid
4245
container
43-
spacing={{ xs: 1, md: 1 }}
46+
spacing={{ xs: 0.5, md: 0.5 }}
4447
columns={{ xs: 4, sm: 4, md: 4 }}
45-
sx={{ maxWidth: '200px' }}
48+
justifyContent="center"
4649
>
4750
{htmlTypesToRender.map((option) => {
4851
if (
@@ -66,27 +69,36 @@ const DragDropPanel = (props): JSX.Element => {
6669
</Grid>
6770
{state.projectType === 'Classic React' ? (
6871
<h3 style={{ color: !isDarkMode ? '#C6C6C6' : '#fff' }}>
69-
REACT ROUTER
72+
React Router
7073
</h3>
7174
) : null}
72-
{htmlTypesToRender.map((option) => {
73-
if (
74-
(option.name === 'Switch' ||
75-
option.name === 'LinkTo' ||
76-
option.name === 'Route') &&
77-
state.projectType === 'Classic React'
78-
) {
79-
return (
80-
<HTMLItem
81-
name={option.name}
82-
key={`html-${option.name}`}
83-
id={option.id}
84-
Icon={option.icon}
85-
handleDelete={handleDelete}
86-
/>
87-
);
88-
}
89-
})}
75+
<Grid
76+
container
77+
spacing={{ xs: 0.5, md: 0.5 }}
78+
columns={{ xs: 4, sm: 4, md: 4 }}
79+
justifyContent="center"
80+
>
81+
{htmlTypesToRender.map((option) => {
82+
if (
83+
(option.name === 'Switch' ||
84+
option.name === 'LinkTo' ||
85+
option.name === 'Route') &&
86+
state.projectType === 'Classic React'
87+
) {
88+
return (
89+
<Grid item xs={2} sm={2} md={2}>
90+
<HTMLItem
91+
name={option.name}
92+
key={`html-${option.name}`}
93+
id={option.id}
94+
Icon={option.icon}
95+
handleDelete={handleDelete}
96+
/>
97+
</Grid>
98+
);
99+
}
100+
})}
101+
</Grid>
90102

91103
{state.projectType === 'Next.js' ? (
92104
<h3 style={{ color: !isDarkMode ? '#C6C6C6' : '#fff' }}>Next.js</h3>

app/src/components/left/ElementsContainer.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Drawer, List, ListItem, ListItemIcon } from '@mui/material';
1+
import { Box, Drawer, List, ListItem, ListItemIcon } from '@mui/material';
22
import React, { useCallback, useEffect } from 'react';
33
import { useDispatch, useSelector } from 'react-redux';
44

@@ -38,13 +38,22 @@ const ElementsContainer = (props): JSX.Element => {
3838
}, []);
3939

4040
return (
41-
<Grid container direction="column" alignItems="center">
41+
<Box
42+
sx={{
43+
display: 'flex',
44+
flexDirection: 'column',
45+
alignItems: 'center',
46+
justifyContent: 'top',
47+
color: '#ffffff',
48+
textAlign: 'center'
49+
}}
50+
>
4251
<h4>Drag and Drop</h4>
4352
<DragDropPanel />
4453
<div id={'CompBottomHalf'}>
4554
<ComponentDrag isThemeLight={props.isThemeLight} />
4655
</div>
47-
</Grid>
56+
</Box>
4857
);
4958
};
5059

app/src/components/left/HTMLPanel.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
import React, { useState, useCallback, useEffect } from 'react';
1+
import { Button, InputLabel } from '@mui/material';
2+
import React, { useCallback, useEffect, useState } from 'react';
23
import { useDispatch, useSelector } from 'react-redux';
4+
5+
import { RootState } from '../../redux/store';
6+
import TextField from '@mui/material/TextField';
37
import { addElement } from '../../redux/reducers/slice/appStateSlice';
48
import makeStyles from '@mui/styles/makeStyles';
5-
import {
6-
Button,
7-
InputLabel
8-
} from '@mui/material';
9-
import TextField from '@mui/material/TextField';
10-
import { RootState } from '../../redux/store';
119

1210
/*
1311
DESCRIPTION: This is the bottom half of the left panel, starting from the 'HTML
@@ -30,8 +28,10 @@ const HTMLPanel = (props): JSX.Element => {
3028
const [name, setName] = useState('');
3129
const [errorMsg, setErrorMsg] = useState('');
3230
const [errorStatus, setErrorStatus] = useState(false);
33-
const isDarkMode = useSelector((store:RootState) => store.darkMode.isDarkMode);
34-
const state = useSelector((store:RootState) => store.appState);
31+
const isDarkMode = useSelector(
32+
(store: RootState) => store.darkMode.isDarkMode
33+
);
34+
const state = useSelector((store: RootState) => store.appState);
3535
const dispatch = useDispatch();
3636
let startingID = 0;
3737
state.HTMLTypes.forEach((element) => {
@@ -338,7 +338,7 @@ const useStyles = makeStyles({
338338
alignSelf: 'center'
339339
},
340340
lightThemeFontColor: {
341-
color: '#155084',
341+
color: '#C6C6C6',
342342
'& .MuiInputBase-root': {
343343
color: 'rgba (0, 0, 0, 0.54)'
344344
}

app/src/components/right/ComponentPanel.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import React, { useState, useEffect, useCallback } from 'react';
2-
import makeStyles from '@mui/styles/makeStyles';
31
import { Button, Checkbox, FormControlLabel, InputLabel } from '@mui/material';
4-
import TextField from '@mui/material/TextField';
2+
import React, { useCallback, useEffect, useState } from 'react';
53
import { useDispatch, useSelector } from 'react-redux';
6-
import { addComponent } from '../../redux/reducers/slice/appStateSlice';
4+
75
import { RootState } from '../../redux/store';
6+
import TextField from '@mui/material/TextField';
7+
import { addComponent } from '../../redux/reducers/slice/appStateSlice';
8+
import makeStyles from '@mui/styles/makeStyles';
89

910
// The component panel section of the left panel displays all components and has the ability to add new components
1011
const ComponentPanel = ({ isThemeLight }): JSX.Element => {
@@ -274,7 +275,7 @@ const useStyles = makeStyles({
274275
borderColor: '#186BB4'
275276
},
276277
newComponent: {
277-
color: '#155084',
278+
color: '#C6C6C6',
278279
fontSize: '95%',
279280
marginBottom: '20px'
280281
},
@@ -302,7 +303,7 @@ const useStyles = makeStyles({
302303
fontSize: '0.85rem'
303304
},
304305
lightThemeFontColor: {
305-
color: '#155084',
306+
color: '#C6C6C6',
306307
'& .MuiInputBase-root': {
307308
color: 'rgba (0, 0, 0, 0.54)'
308309
}

app/src/components/right/ComponentPanelRoutingItem.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import React, { useState } from 'react';
2+
23
import Grid from '@mui/material/Grid';
3-
import makeStyles from '@mui/styles/makeStyles';
4-
import { useDrag } from 'react-dnd';
54
import { ItemTypes } from '../../constants/ItemTypes';
5+
// ------------------------------------------------
6+
import MenuItem from '@mui/material/MenuItem';
7+
import { RootState } from '../../redux/store';
68
import Select from '@mui/material/Select';
9+
import makeStyles from '@mui/styles/makeStyles';
10+
import { useDrag } from 'react-dnd';
711
import { useSelector } from 'react-redux';
8-
import { RootState } from '../../redux/store';
912

10-
// ------------------------------------------------
11-
import MenuItem from '@mui/material/MenuItem';
1213
// ------------------------------------------------
1314

1415
/*
@@ -75,7 +76,7 @@ const ComponentPanelRoutingItem: React.FC<{}> = () => {
7576
ref={drag}
7677
xs={8}
7778
style={{
78-
color: '#155084',
79+
color: '#C6C6C6',
7980
backgroundColor: 'transparent',
8081
height: '75px',
8182
marginBottom: '15px',

app/src/containers/CustomizationPanel.tsx

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
import React, { useState, useEffect, useMemo, useCallback } from 'react';
2-
import { DataGrid} from '@mui/x-data-grid';
31
import {
4-
FormControl,
5-
TextField,
62
Button,
73
Dialog,
84
DialogActions,
95
DialogContent,
106
DialogContentText,
117
DialogTitle,
8+
FormControl,
129
List,
1310
ListItem,
14-
ListItemText
11+
ListItemText,
12+
TextField
1513
} from '@mui/material';
16-
import makeStyles from '@mui/styles/makeStyles';
17-
import ClearIcon from '@mui/icons-material/Clear';
18-
import createModal from '../components/right/createModal';
19-
import ErrorMessages from '../constants/ErrorMessages';
20-
import ProjectManager from '../components/right/ProjectManager';
21-
import FormSelector from '../components/form/Selector';
22-
import UseStateModal from '../components/bottom/UseStateModal';
23-
import { useDispatch, useSelector } from 'react-redux';
24-
14+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
2515
import {
2616
changeTailwind,
27-
updateStateUsed,
28-
updateUseContext,
29-
updateCss,
30-
updateEvents,
17+
deleteChild,
3118
deleteEventAction,
3219
deletePage,
3320
deleteReusableComponent,
34-
updateAttributes,
35-
deleteChild,
21+
redo,
3622
undo,
37-
redo
23+
updateAttributes,
24+
updateCss,
25+
updateEvents,
26+
updateStateUsed,
27+
updateUseContext
3828
} from '../redux/reducers/slice/appStateSlice';
29+
import { useDispatch, useSelector } from 'react-redux';
30+
31+
import ClearIcon from '@mui/icons-material/Clear';
32+
import { DataGrid } from '@mui/x-data-grid';
33+
import ErrorMessages from '../constants/ErrorMessages';
34+
import FormSelector from '../components/form/Selector';
35+
import ProjectManager from '../components/right/ProjectManager';
36+
import UseStateModal from '../components/bottom/UseStateModal';
37+
import createModal from '../components/right/createModal';
38+
import makeStyles from '@mui/styles/makeStyles';
3939

4040
// Previously named rightContainer, Renamed to Customizationpanel this now hangs on BottomTabs
4141
// need to pass in props to use the useHistory feature of react router
@@ -981,7 +981,7 @@ const useStyles = makeStyles({
981981
select: {
982982
fontSize: '1em',
983983
'> .MuiSelect-icon': {
984-
color: '#155084'
984+
color: '#C6C6C6'
985985
}
986986
},
987987
selectInput: {

app/src/public/styles/style.css

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ span.material-symbols-outlined {
174174
flex-direction: column;
175175
justify-content: space-around;
176176
flex-wrap: wrap;
177-
/* width: 90%; */
177+
width: 90%;
178178
flex-grow: 1;
179179
/* border: 3px solid #C6C6C6; */
180180
/* border-radius: 10px; */
@@ -197,16 +197,34 @@ span.material-symbols-outlined {
197197
flex-direction: column;
198198
justify-content: space-around;
199199
flex-wrap: wrap;
200-
width: 90%;
201200
flex-grow: 1;
202201
border: 3px solid white;
203202
}
204203

205204
#HTMLItemsTopHalf {
205+
display: flex;
206+
flex-direction: column;
207+
align-items: center;
208+
padding-right: 20px;
209+
justify-content: top;
206210
height: 52vh;
211+
text-align: center;
212+
overflow-x: hidden;
207213
overflow-y: auto;
208214
}
209215

216+
#HTMLItemsTopHalf::-webkit-scrollbar {
217+
width: .5rem;
218+
height: .5rem;
219+
}
220+
221+
#HTMLItemsTopHalf::-webkit-scrollbar-thumb {
222+
transition: .3s ease all;
223+
border-color: transparent;
224+
background-color: rgba(255, 255, 255, 0.1);
225+
z-index: 40;
226+
}
227+
210228
#CompBottomHalf {
211229
flex-grow: 1;
212230
overflow-y: auto;
@@ -221,6 +239,8 @@ span.material-symbols-outlined {
221239
}
222240

223241
#HTMLItemsGrid {
242+
display: flex;
243+
224244
/* margin-left: 35px; */
225245
}
226246

0 commit comments

Comments
 (0)