Skip to content

Commit 602c739

Browse files
yumnazaheedYumna Zaheedmark-trann
authored
Event dropdown (#1089)
* fixed create event dropdown and make time buttons smaller * fixed create event dropdown and reduced size of time buttons * Update client/src/components/controls/CustomEvent.tsx Co-authored-by: Mark Tran <29350857+mark-trann@users.noreply.github.com> * hardcoded timePickerWidth * removed redundant code * removed timepickerwidth --------- Co-authored-by: Yumna Zaheed <z5550542@student.unsw.edu.au> Co-authored-by: Mark Tran <29350857+mark-trann@users.noreply.github.com>
1 parent 13caca1 commit 602c739

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

‎client/src/components/controls/CustomEvent.tsx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,16 @@ const CustomEvent: React.FC = () => {
240240
horizontal: 'right',
241241
}}
242242
transformOrigin={{
243-
vertical: 'bottom',
243+
vertical: 'top',
244244
horizontal: 'right',
245245
}}
246+
slotProps={{
247+
paper: {
248+
style: {
249+
minWidth: createEventAnchorEl?.clientWidth,
250+
},
251+
},
252+
}}
246253
>
247254
<StyledList>
248255
<TabContext value={eventType}>

‎client/src/components/controls/CustomEventGeneral.tsx‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,31 @@ const CustomEventGeneral: React.FC<CustomEventGeneralProps> = ({
8989
<StyledListItem>
9090
<StyledListItemText primary="Start time" />
9191
<TimePicker
92-
// Displays time as the time of the grid the user pressed
93-
// when popover has just been opened
9492
value={isInitialStartTime ? initialStartTime : startTime}
9593
onChange={(e) => {
9694
if (e) setStartTime(e);
9795
setIsInitialStartTime(false);
9896
}}
97+
slotProps={{
98+
textField: {
99+
size: 'small',
100+
sx: { width: 180 }
101+
}
102+
}}
99103
/>
100104
</StyledListItem>
101105
<StyledListItem>
102106
<StyledListItemText primary="End time" />
103107
<TimePicker
104108
value={isInitialEndTime ? initialEndTime : endTime}
105109
label={!areValidEventTimes(startTime, endTime) ? 'End time must be after start' : ''}
106-
slotProps={{ textField: { color: areValidEventTimes(startTime, endTime) ? 'primary' : 'error' } }}
110+
slotProps={{
111+
textField: {
112+
size: 'small',
113+
color: areValidEventTimes(startTime, endTime) ? 'primary' : 'error',
114+
sx: { width: 180 }
115+
}
116+
}}
107117
onChange={(e) => {
108118
if (e) setEndTime(e);
109119
setIsInitialEndTime(false);

0 commit comments

Comments
 (0)