Skip to content

Commit 289939b

Browse files
committed
added back headerbutton on modulepanel, fixed custom elements panel headerbutton centering when it was accessed from the module panel
1 parent 893927a commit 289939b

File tree

4 files changed

+76
-36
lines changed

4 files changed

+76
-36
lines changed

app/src/components/left/CreatePanel.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,15 @@ const CreatePanel = (props): JSX.Element => {
220220

221221
return (
222222
<div className={'MUIItems'}>
223-
{/* <HeaderButton
224-
isThemeLight={props.isThemeLight}
225-
infoText={`Add more HTML elements to drag and drop onto your canvas.
226-
Each element requires a tag. For a list of all possible HTML elements,
227-
please refer to https://developer.mozilla.org/en-US/docs/Web/HTML/Element.`}
228-
headerName={'Custom Elements'}
229-
id={'CustomElementsBtn'}
230-
/> */}
223+
<Button
224+
component="label"
225+
aria-label="Custom Elements"
226+
id="customElements"
227+
key="customElements-header"
228+
textAlign="center"
229+
>
230+
Custom Elements
231+
</Button>
231232
<HTMLPanel isThemeLight={props.isThemeLight} />
232233
{makeMenuCategory([
233234
state.HTMLTypes.filter((type) => type.id > 10000).map(

app/src/components/left/HTMLPanel.tsx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,18 @@ const HTMLPanel = (props): JSX.Element => {
206206
vertical: 'bottom',
207207
horizontal: 'left'
208208
}}
209-
></Popover>
209+
>
210+
<div className={classes.popover}>
211+
<div className={classes.popoverIcon}>
212+
<HelpIcon id={id} size="small" />
213+
</div>
214+
<div>
215+
Add modules to create a canvas for grouping your components.
216+
Once created, you can drag modules into other modules to link
217+
them. Each module will be exported as its own file.
218+
</div>
219+
</div>
220+
</Popover>
210221
</div>
211222
<div className={classes.inputWrapper}>
212223
<TextField
@@ -272,6 +283,19 @@ const useStyles = makeStyles({
272283
marginTop: '10px',
273284
width: '150px',
274285
borderRadius: '5px'
286+
},
287+
popover: {
288+
backgroundColor: '#ffdbbb',
289+
display: 'flex',
290+
color: 'black',
291+
fontSize: '0.8rem',
292+
padding: '8px',
293+
width: '300px'
294+
},
295+
popoverIcon: {
296+
paddingRight: '10px',
297+
paddingLeft: '8px',
298+
paddingTop: '10px'
275299
}
276300
});
277301

app/src/components/left/ModulePanel.tsx

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,15 @@ const ModulePanel: React.FC<ModulePanelProps> = ({ isThemeLight }) => {
5353
return (
5454
<div className="modulePanelContainer">
5555
{isEditingModule ? (
56-
<CreatePanel />
56+
<div
57+
className="createComponent"
58+
style={{
59+
color: '#f7f4dc',
60+
textAlign: 'center'
61+
}}
62+
>
63+
<CreatePanel />
64+
</div>
5765
) : (
5866
<div
5967
className="createComponent"
@@ -94,34 +102,42 @@ const ModulePanel: React.FC<ModulePanelProps> = ({ isThemeLight }) => {
94102
<ComponentsContainer
95103
handleClickEditModule={handleClickEditModule}
96104
/>
97-
<HeaderButton
98-
headerName="Add Router"
99-
infoText="Turn a module into a single page app with a router."
100-
/>
101-
<Grid container justifyContent="space-around" columnSpacing={2}>
102-
{htmlTypesToRender.map((option) => {
103-
if (
104-
(option.name === 'Switch' ||
105-
option.name === 'LinkTo' ||
106-
option.name === 'Route') &&
107-
state.projectType === 'Classic React'
108-
) {
109-
return (
110-
<HTMLItem
111-
name={option.name}
112-
key={`html-${option.name}`}
113-
id={option.id}
114-
icon={option.icon}
115-
handleDelete={handleDelete}
116-
/>
117-
);
118-
}
119-
})}
120-
</Grid>
121105
</div>
122106
)}
123107
</div>
124108
)}
109+
<div
110+
className="createComponent"
111+
style={{
112+
color: '#f88e16',
113+
textAlign: 'center'
114+
}}
115+
>
116+
<HeaderButton
117+
headerName="Add Router"
118+
infoText="Turn a module into a single page app with a router."
119+
/>
120+
</div>
121+
<Grid container justifyContent="space-around" columnSpacing={2}>
122+
{htmlTypesToRender.map((option) => {
123+
if (
124+
(option.name === 'Switch' ||
125+
option.name === 'LinkTo' ||
126+
option.name === 'Route') &&
127+
state.projectType === 'Classic React'
128+
) {
129+
return (
130+
<HTMLItem
131+
name={option.name}
132+
key={`html-${option.name}`}
133+
id={option.id}
134+
icon={option.icon}
135+
handleDelete={handleDelete}
136+
/>
137+
);
138+
}
139+
})}
140+
</Grid>
125141
</div>
126142
);
127143
};

app/src/components/right/ComponentPanelItem.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ const ComponentPanelItem: React.FC<{
8282
border: '2px solid',
8383
borderRadius: '10px',
8484
borderColor: '#2D313A',
85-
margin: '5px 0px',
86-
width: '100vw',
85+
width: '200px',
8786
maxWidth: '240px',
8887
height: '3rem',
8988
boxSizing: 'border-box',

0 commit comments

Comments
 (0)