Skip to content

Commit d5dbe7d

Browse files
authored
Merge pull request #2023 from trillium/ts_2022
Add accordion to edit project page
2 parents 55372ec + c7f768f commit d5dbe7d

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

client/src/components/ProjectForm.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export default function ProjectForm({
191191
>
192192
<EditIcon style={{ p: 1 }} />
193193
<Typography sx={{ p: 1, fontSize: '14px', fontWeight: '600' }}>
194-
{editMode ? 'Cancel' : 'Edit Mode'}
194+
{editMode ? 'Cancel' : 'Edit'}
195195
</Typography>
196196
</Box>
197197
);
@@ -239,6 +239,7 @@ export default function ProjectForm({
239239
<TitledBox
240240
title={editMode ? 'Editing Project' : 'Project Information'}
241241
badge={isEdit ? editIcon() : addIcon()}
242+
expandable={true}
242243
>
243244
<form
244245
id="project-form"
@@ -297,7 +298,7 @@ export default function ProjectForm({
297298
</Grid>
298299
</TitledBox>
299300
) : (
300-
<TitledBox title={'Project Information'}>
301+
<TitledBox title={'Project Information'} expandable={true}>
301302
{' '}
302303
<form
303304
id="project-form"

client/src/components/manageProjects/editPMs/editProjectMembers.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ const EditProjectMembers = ({ projectToEdit }) => {
140140
<TitledBox
141141
title={'Project Members (Event Editors)'}
142142
badge={editIcon()}
143+
expandable={true}
143144
>
144145
{/* Email search componennt */}
145146
<Grid container direction="column" sx={{ width: '100%', backgroundColor: editMode ? 'white' : '' }}>

client/src/components/manageProjects/editProject.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ const EditProject = ({
121121
display: 'flex',
122122
'&:hover': { color: 'red', cursor: 'pointer' },
123123
}}
124-
onClick={() => setIsCreateNew(true)}
124+
onClick={(e) => {
125+
e.stopPropagation();
126+
setIsCreateNew(true);
127+
}}
125128
>
126129
<PlusIcon style={{ marginRight: '7px' }} />
127130
<Typography
@@ -134,6 +137,7 @@ const EditProject = ({
134137
</Typography>
135138
</Box>
136139
}
140+
expandable={true}
137141
>
138142
<div className="event-list">
139143
<h2 className="event-alert">{eventAlert}</h2>
@@ -157,7 +161,7 @@ const EditProject = ({
157161
</div>
158162
</TitledBox>
159163

160-
<TitledBox title="Manually Edit Events Checkin">
164+
<TitledBox title="Manually Edit Events Checkin" expandable={true}>
161165
<div className="event-list">
162166
<h2 className="event-alert">{eventAlert}</h2>
163167
<ul>

client/src/components/parts/boxes/TitledBox.jsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { useState } from 'react';
22
import { Box, Typography, Divider } from '@mui/material';
33
import Accordion from '@mui/material/Accordion';
44
import AccordionDetails from '@mui/material/AccordionDetails';
@@ -22,9 +22,15 @@ export default function TitledBox({
2222
childrenBoxSx,
2323
expandable = false,
2424
}) {
25+
const [isExpanded, setIsExpanded] = useState(false);
26+
2527
if (expandable) {
2628
return (
27-
<Accordion sx={{ bgcolor: '#F5F5F5', my: 3 }}>
29+
<Accordion
30+
sx={{ bgcolor: '#F5F5F5', my: 3 }}
31+
expanded={isExpanded}
32+
onChange={(event, expanded) => setIsExpanded(expanded)}
33+
>
2834
<AccordionSummary
2935
expandIcon={<ExpandMoreIcon />}
3036
aria-controls="panel-content"
@@ -41,7 +47,13 @@ export default function TitledBox({
4147
<Typography sx={{ fontSize: '18px', fontWeight: '600' }}>
4248
{title}
4349
</Typography>
44-
{badge}
50+
<Box
51+
onClick={(e) => {
52+
if (isExpanded) e.stopPropagation();
53+
}}
54+
>
55+
{badge}
56+
</Box>
4557
</Box>
4658
</AccordionSummary>
4759
<Divider sx={{ borderColor: 'rgba(0,0,0,1)' }} />

0 commit comments

Comments
 (0)