Skip to content

Commit 7720083

Browse files
authored
Merge pull request #3981 from Northeastern-Electric-Racing/3961-overlaping-icon-fix
#3961- adding flexible spacing
2 parents 7fd437e + 97716be commit 7720083

2 files changed

Lines changed: 84 additions & 51 deletions

File tree

src/frontend/src/pages/CalendarPage/EventClickPopup.tsx

Lines changed: 49 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -158,55 +158,57 @@ export const EventClickContent: React.FC<EventClickContentProps> = ({
158158
{pendingReason}
159159
</Alert>
160160
)}
161-
<Box sx={{ position: 'relative', mb: 2 }}>
162-
{!disable && canEditOrDelete && (
163-
<Box sx={{ position: 'absolute', top: 0, right: 0, display: 'flex', gap: 0.5 }}>
164-
<IconButton
165-
size="small"
166-
onClick={(e) => {
167-
stopClick(e);
168-
onEdit(event);
169-
}}
170-
sx={{
171-
color: theme.palette.grey[500],
172-
'&:hover': {
173-
color: theme.palette.common.white,
174-
bgcolor: 'transparent'
175-
}
176-
}}
177-
>
178-
<EditIcon fontSize="small" />
179-
</IconButton>
180-
<IconButton
181-
size="small"
182-
onClick={(e) => {
183-
stopClick(e);
184-
onDelete(event);
185-
}}
161+
162+
<Box sx={{ mb: 2 }}>
163+
<Stack direction="row" spacing={1} alignItems="flex-start">
164+
{getTeamTypeIcon(event.teamType?.name ?? '', true)}
165+
166+
<Box sx={{ flex: 1, minWidth: 0 }}>
167+
<Typography
168+
variant="h6"
186169
sx={{
187-
color: theme.palette.grey[500],
188-
'&:hover': {
189-
color: '#ef5350',
190-
bgcolor: 'transparent'
191-
}
170+
fontWeight: 'bold',
171+
color: calendarColor,
172+
whiteSpace: 'normal',
173+
overflowWrap: 'anywhere',
174+
lineHeight: 1.2
192175
}}
193176
>
194-
<DeleteIcon fontSize="small" />
195-
</IconButton>
177+
{name}
178+
</Typography>
196179
</Box>
197-
)}
198-
<Stack direction="row" spacing={1} alignItems="center" sx={{ pr: 4 }}>
199-
{getTeamTypeIcon(event.teamType?.name ?? '', true)}
200-
<Typography
201-
variant="h6"
202-
noWrap
203-
sx={{
204-
fontWeight: 'bold',
205-
color: calendarColor
206-
}}
207-
>
208-
{name}
209-
</Typography>
180+
181+
{!disable && canEditOrDelete && (
182+
<Stack direction="row" spacing={0.5} sx={{ flexShrink: 0 }}>
183+
<IconButton
184+
size="small"
185+
onClick={(e) => {
186+
stopClick(e);
187+
onEdit(event);
188+
}}
189+
sx={{
190+
color: theme.palette.grey[500],
191+
'&:hover': { color: theme.palette.common.white, bgcolor: 'transparent' }
192+
}}
193+
>
194+
<EditIcon fontSize="small" />
195+
</IconButton>
196+
197+
<IconButton
198+
size="small"
199+
onClick={(e) => {
200+
stopClick(e);
201+
onDelete(event);
202+
}}
203+
sx={{
204+
color: theme.palette.grey[500],
205+
'&:hover': { color: '#ef5350', bgcolor: 'transparent' }
206+
}}
207+
>
208+
<DeleteIcon fontSize="small" />
209+
</IconButton>
210+
</Stack>
211+
)}
210212
</Stack>
211213

212214
<Stack direction="row" spacing={1} alignItems="center" sx={{ mt: 0.5, flexWrap: 'wrap' }}>
@@ -426,6 +428,7 @@ export const EventClickContent: React.FC<EventClickContentProps> = ({
426428
</Typography>
427429
</Stack>
428430
)}
431+
429432
{addApprovalButtons && canApprove && (
430433
<Box sx={{ display: 'flex', justifyContent: 'flex-end' }}>
431434
<NERSuccessButton
@@ -443,6 +446,7 @@ export const EventClickContent: React.FC<EventClickContentProps> = ({
443446
>
444447
Approve
445448
</NERSuccessButton>
449+
446450
<NERFailButton
447451
sx={{ mx: 1 }}
448452
onClick={async () => {

src/frontend/src/pages/CalendarPage/EventPartialInfoView.tsx

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,28 @@ const EventPartialInfoView: React.FC<EventInfoProps> = ({ event, eventTypes, cal
4848
}}
4949
>
5050
<Stack direction="row" spacing={5}>
51-
<Stack direction="row" sx={{ minWidth: 200 }}>
51+
<Stack direction="row" sx={{ minWidth: 0, flex: 1 }}>
5252
{getTeamTypeIcon(event.teamType?.name ?? '', false)}
53-
<Typography marginX={0.5} marginY={0.5} lineHeight={'120%'} fontSize={12} fontWeight="bold" align="left">
53+
<Typography
54+
marginX={0.5}
55+
marginY={0.5}
56+
lineHeight={'120%'}
57+
fontSize={12}
58+
fontWeight="bold"
59+
align="left"
60+
sx={{
61+
flex: 1,
62+
minWidth: 0,
63+
overflow: 'hidden',
64+
textOverflow: 'ellipsis',
65+
whiteSpace: 'nowrap'
66+
}}
67+
>
5468
{name}
5569
</Typography>
5670
</Stack>
57-
<Stack direction="row" sx={{ minWidth: 150 }}>
71+
72+
<Stack direction="row" sx={{ minWidth: 150, flexShrink: 0 }}>
5873
<AccessTimeIcon />
5974
{event.allDay ? (
6075
<Typography marginX={0.5} marginY={0.5} lineHeight={'120%'} fontSize={12} fontWeight="bold" align="left">
@@ -67,14 +82,28 @@ const EventPartialInfoView: React.FC<EventInfoProps> = ({ event, eventTypes, cal
6782
)}
6883
</Stack>
6984
</Stack>
85+
7086
<Stack direction="row" spacing={5}>
71-
<Stack direction="row" sx={{ minWidth: 200 }}>
87+
<Stack direction="row" sx={{ minWidth: 0, flex: 1 }}>
7288
<LocationOnIcon />
73-
<Typography marginX={0.5} marginY={0.5} lineHeight={'120%'} fontSize={12} fontWeight="bold" align="left">
89+
<Typography
90+
marginX={0.5}
91+
marginY={0.5}
92+
lineHeight={'120%'}
93+
fontSize={12}
94+
fontWeight="bold"
95+
align="left"
96+
sx={{
97+
overflow: 'hidden',
98+
textOverflow: 'ellipsis',
99+
whiteSpace: 'nowrap'
100+
}}
101+
>
74102
{event.location ?? 'N/A'}
75103
</Typography>
76104
</Stack>
77-
<Stack direction="row" sx={{ minWidth: 150 }}>
105+
106+
<Stack direction="row" sx={{ minWidth: 150, flexShrink: 0 }}>
78107
<GroupIcon />
79108
<Typography marginX={0.5} marginY={0.5} lineHeight={'120%'} fontSize={12} fontWeight="bold" align="left">
80109
{event.requiredMembers[0]

0 commit comments

Comments
 (0)