Skip to content

Commit 52ea198

Browse files
authored
Customized calendar & time pickers for DateTimePicker component (#1508)
Signed-off-by: Benjamin Perez <[email protected]>
1 parent 281bd78 commit 52ea198

File tree

3 files changed

+115
-4
lines changed

3 files changed

+115
-4
lines changed

portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ObjectDetails/ObjectMetaData.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ const ObjectMetaData = ({
9090
: decodeURIComponent(metaData[element]);
9191

9292
return (
93-
<Box className={classes.metadataLinear}>
93+
<Box
94+
className={classes.metadataLinear}
95+
key={`box-meta-${element}-${index.toString()}`}
96+
>
9497
<strong>{element}</strong>
9598
<br />
9699
{renderItem}

portal-ui/src/screens/Console/Common/FormComponents/DateTimePickerWrapper/DateTimePickerWrapper.tsx

Lines changed: 109 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// This file is part of MinIO Console Server
2-
// Copyright (c) 2021 MinIO, Inc.
2+
// Copyright (c) 2022 MinIO, Inc.
33
//
44
// This program is free software: you can redistribute it and/or modify
55
// it under the terms of the GNU Affero General Public License as published by
@@ -114,6 +114,111 @@ const styles = (theme: Theme) =>
114114
width: 8,
115115
marginTop: 2,
116116
},
117+
paperOverride: {
118+
"& .MuiCalendarPicker-root": {
119+
padding: "0 22px",
120+
"& > div": {
121+
padding: 0,
122+
"& > div > div.PrivatePickersFadeTransitionGroup-root:first-of-type":
123+
{
124+
color: "#0A224C",
125+
fontWeight: "bold",
126+
},
127+
"& > div > div.PrivatePickersFadeTransitionGroup-root:last-of-type": {
128+
color: "#9D9E9D",
129+
"& + button.MuiButtonBase-root": {
130+
color: "#9D9E9D",
131+
},
132+
},
133+
"& > div:nth-child(2)": {
134+
"& > div": {
135+
width: 0,
136+
},
137+
"& > button.MuiButtonBase-root": {
138+
color: "#0A224C",
139+
},
140+
},
141+
},
142+
},
143+
"& .MuiTypography-root.MuiTypography-caption": {
144+
width: 26,
145+
height: 26,
146+
margin: 5,
147+
color: "#BCBCBC",
148+
fontSize: 10,
149+
},
150+
"& button.MuiPickersDay-root": {
151+
fontWeight: "bold",
152+
width: 26,
153+
height: 26,
154+
margin: 5,
155+
textAlign: "center",
156+
"&.Mui-selected": {
157+
backgroundColor: theme.palette.primary.main,
158+
color: "#fff",
159+
},
160+
},
161+
"& div.MuiPickersDay-hiddenDaySpacingFiller": {
162+
width: 26,
163+
height: 26,
164+
margin: 5,
165+
},
166+
"& div.PrivatePickersSlideTransition-root": {
167+
minHeight: 240,
168+
},
169+
"& div.MuiCalendarPicker-viewTransitionContainer": {
170+
borderTop: "#F0F3F5 1px solid",
171+
},
172+
"& .MuiClockPicker-arrowSwitcher": {
173+
"& > div": {
174+
width: 0,
175+
},
176+
"& > button.MuiButtonBase-root": {
177+
color: "#0A224C",
178+
},
179+
"& + div > div": {
180+
width: 255,
181+
height: 255,
182+
backgroundColor: "#fff",
183+
border: "#F0F3F5 3px solid",
184+
"& > div:nth-child(2)": {
185+
backgroundColor: "#B4B5B4",
186+
width: 12,
187+
height: 12,
188+
"&::before": {
189+
content: "' '",
190+
width: 35,
191+
height: 35,
192+
display: "block",
193+
position: "absolute",
194+
border: "#F0F3F5 3px solid",
195+
top: -12,
196+
left: -12,
197+
borderRadius: "100%",
198+
},
199+
},
200+
"& > div:nth-child(3)": {
201+
backgroundColor: "#B4B5B4",
202+
width: 4,
203+
},
204+
"& > div:last-of-type": {
205+
marginTop: 15,
206+
"& > span": {
207+
color: "#0A224C",
208+
"&.Mui-selected": {
209+
color: "#fff",
210+
},
211+
"&[aria-label='1 hours'], &[aria-label='2 hours'], &[aria-label='3 hours'], &[aria-label='4 hours'], &[aria-label='5 hours'], &[aria-label='6 hours'], &[aria-label='7 hours'], &[aria-label='8 hours'], &[aria-label='9 hours'], &[aria-label='10 hours'], &[aria-label='11 hours'], &[aria-label='12 hours']":
212+
{
213+
fontWeight: "bold",
214+
fontSize: 20,
215+
marginTop: -1,
216+
},
217+
},
218+
},
219+
},
220+
},
221+
},
117222
...fieldBasic,
118223
...tooltipHelper,
119224
});
@@ -181,6 +286,9 @@ const DateTimePickerWrapper = ({
181286
<TextField id={id} variant="standard" {...props} disabled />
182287
)}
183288
ampm={false}
289+
PopperProps={{
290+
className: classes.paperOverride,
291+
}}
184292
/>
185293
</LocalizationProvider>
186294
);

portal-ui/src/screens/Console/Menu/ConsoleMenuList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ const ConsoleMenuList = ({
102102
className={`${stateClsName} group-wrapper main-list`}
103103
>
104104
<React.Fragment>
105-
{(menuItems || []).map((menuGroup: any) => {
105+
{(menuItems || []).map((menuGroup: any, index) => {
106106
if (menuGroup) {
107107
return (
108108
<MenuItem
109109
stateClsName={stateClsName}
110110
page={menuGroup}
111-
key={menuGroup.id}
111+
key={`${menuGroup.id}-${index.toString()}`}
112112
id={menuGroup.id}
113113
selectedMenuGroup={openGroup}
114114
setSelectedMenuGroup={setOpenGroup}

0 commit comments

Comments
 (0)