Skip to content

Commit 5523ba9

Browse files
committed
Integrated MUI component into more files
1 parent ca3da69 commit 5523ba9

File tree

3 files changed

+27
-22
lines changed

3 files changed

+27
-22
lines changed

app/src/components/left/DragDropPanel.tsx

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useDispatch, useSelector } from 'react-redux';
22
import Grid from '@mui/material/Grid';
33
import HTMLItem from './HTMLItem';
4+
import MUIItem from './MUI_Item';
45
import React from 'react';
56
import { RootState } from '../../redux/store';
67
import { deleteElement } from '../../redux/reducers/slice/appStateSlice';
@@ -10,18 +11,17 @@ import AccordionSummary from '@mui/material/AccordionSummary';
1011
import AccordionDetails from '@mui/material/AccordionDetails';
1112
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
1213
import { makeStyles } from '@mui/styles';
13-
import ComponentDrag from './ComponentDrag';
14-
14+
import ComponentDrag from './ComponentDrag';
1515

1616
const useStyles = makeStyles({
1717
accordion: {
1818
backgroundColor: '#000000', // Set the background color to gray
19-
color: '#ffffff', // Set the text color to white
19+
color: '#ffffff' // Set the text color to white
2020
},
2121
accordionSummary: {
2222
backgroundColor: '#000000', // Set the background color of the summary to gray
23-
color: '#ffffff', // Set the text color of the summary to white
24-
},
23+
color: '#ffffff' // Set the text color of the summary to white
24+
}
2525
});
2626

2727
const DragDropPanel = (props): JSX.Element => {
@@ -46,6 +46,8 @@ const DragDropPanel = (props): JSX.Element => {
4646
(type) => type.name !== 'separator'
4747
);
4848

49+
const muiTypesToRender = state.MUITypes;
50+
4951
return (
5052
<div className={'HTMLItems'}>
5153
<div id="HTMLItemsTopHalf">
@@ -93,7 +95,7 @@ const DragDropPanel = (props): JSX.Element => {
9395
</Grid>
9496
</AccordionDetails>
9597
</Accordion>
96-
98+
9799
{/* MUI Components */}
98100
<Accordion className={classes.accordion}>
99101
<AccordionSummary
@@ -106,23 +108,23 @@ const DragDropPanel = (props): JSX.Element => {
106108
</AccordionSummary>
107109
<AccordionDetails>
108110
<Grid container justifyContent="center">
109-
{htmlTypesToRender.map((option) => {
110-
if (option.name === 'MUI') {
111-
return (
112-
<HTMLItem
113-
name={option.name}
114-
key={`html-${option.name}`}
115-
id={option.id}
116-
icon={option.icon}
117-
handleDelete={handleDelete}
118-
/>
119-
);
120-
}
111+
{muiTypesToRender.map((option) => {
112+
// if (option.name === 'MUI') {
113+
return (
114+
<HTMLItem
115+
name={option.name}
116+
key={`mui-${option.name}`}
117+
id={option.id}
118+
icon={option.icon}
119+
handleDelete={handleDelete}
120+
/>
121+
);
122+
// }
121123
})}
122124
</Grid>
123125
</AccordionDetails>
124126
</Accordion>
125-
127+
126128
{/* React Router */}
127129
<Accordion className={classes.accordion}>
128130
<AccordionSummary
@@ -156,7 +158,7 @@ const DragDropPanel = (props): JSX.Element => {
156158
</Grid>
157159
</AccordionDetails>
158160
</Accordion>
159-
161+
160162
{/* Next.js */}
161163
{state.projectType === 'Next.js' ? (
162164
<h3 style={{ color: 'C6C6C6' }}>Next.js</h3>
@@ -183,4 +185,3 @@ const DragDropPanel = (props): JSX.Element => {
183185
};
184186

185187
export default DragDropPanel;
186-

app/src/interfaces/Interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export interface State {
1717
nextBottomSeparatorId?: number;
1818
nextChildId: number;
1919
HTMLTypes: HTMLType[];
20+
MUITypes: MUIType[];
2021
tailwind: boolean;
2122
stylesheet: string;
2223
codePreview: boolean;

app/src/redux/reducers/slice/appStateSlice.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ import {
55
State,
66
Component,
77
ChildElement,
8-
HTMLType
8+
HTMLType,
9+
MUIType
910
} from '../../../interfaces/Interfaces';
1011
import HTMLTypes from '../../HTMLTypes';
12+
import MUITypes from '../../MUITypes';
1113
import generateCode from '../../../helperFunctions/generateCode';
1214
import manageSeparators from '../../../helperFunctions/manageSeparators';
1315

@@ -40,6 +42,7 @@ export const initialState: State = {
4042
nextChildId: 1,
4143
nextTopSeparatorId: 1000,
4244
HTMLTypes: HTMLTypes, // left as is for now
45+
MUITypes: MUITypes, // left as is for now
4346
tailwind: false,
4447
stylesheet: '',
4548
codePreview: false,

0 commit comments

Comments
 (0)