Skip to content

Commit fc6d935

Browse files
Merge pull request KelvinTegelaar#5808 from k-grube/chore/fix-key-infobar
bugfix: fix missing key prop on CippInfoBar
2 parents 78cb3ce + 70cdfc4 commit fc6d935

1 file changed

Lines changed: 39 additions & 40 deletions

File tree

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,45 @@
1-
import React, { useState } from "react";
2-
import { Box, Card, Stack, SvgIcon, Typography, Skeleton, Tooltip } from "@mui/material";
3-
import { Grid } from "@mui/system";
4-
import { CippOffCanvas } from "../CippComponents/CippOffCanvas";
5-
import { CippPropertyListCard } from "./CippPropertyListCard";
1+
import React, { useState, Fragment } from 'react'
2+
import { Box, Card, Stack, SvgIcon, Typography, Skeleton, Tooltip } from '@mui/material'
3+
import { Grid } from '@mui/system'
4+
import { CippOffCanvas } from '../CippComponents/CippOffCanvas'
5+
import { CippPropertyListCard } from './CippPropertyListCard'
66

77
export const CippInfoBar = ({ data, isFetching }) => {
8-
const [visibleIndex, setVisibleIndex] = useState(null);
8+
const [visibleIndex, setVisibleIndex] = useState(null)
99

1010
return (
1111
<Card>
1212
<Grid container>
1313
{data.map((item, index) => (
14-
<>
14+
<Fragment key={item.name}>
1515
<Grid
1616
size={{ md: 3, sm: 6, xs: 12 }}
17-
key={item.name}
1817
onClick={item.offcanvas ? () => setVisibleIndex(index) : undefined}
1918
sx={{
20-
cursor: item.offcanvas ? "pointer" : "default",
19+
cursor: item.offcanvas ? 'pointer' : 'default',
2120
borderBottom: (theme) => ({
2221
xs: `1px solid ${theme.palette.divider}`,
23-
md: "none",
22+
md: 'none',
2423
}),
2524
borderRight: (theme) => ({
2625
md: `1px solid ${theme.palette.divider}`,
2726
}),
28-
"&:nth-of-type(3)": {
27+
'&:nth-of-type(3)': {
2928
borderBottom: (theme) => ({
3029
xs: `1px solid ${theme.palette.divider}`,
31-
sm: "none",
30+
sm: 'none',
3231
}),
3332
},
34-
"&:nth-of-type(4)": {
35-
borderBottom: "none",
36-
borderRight: "none",
33+
'&:nth-of-type(4)': {
34+
borderBottom: 'none',
35+
borderRight: 'none',
3736
},
3837
}}
3938
>
4039
<Stack alignItems="center" direction="row" spacing={2} sx={{ p: 2, minWidth: 0 }}>
4140
{item?.icon && (
4241
<SvgIcon
43-
color={item.color ? item.color : "primary"}
42+
color={item.color ? item.color : 'primary'}
4443
fontSize="small"
4544
sx={{ flexShrink: 0 }}
4645
>
@@ -52,57 +51,57 @@ export const CippInfoBar = ({ data, isFetching }) => {
5251
<Box
5352
sx={() => {
5453
if (!item?.icon) {
55-
return { pl: 2, minWidth: 0, flex: 1 };
54+
return { pl: 2, minWidth: 0, flex: 1 }
5655
}
57-
return { minWidth: 0, flex: 1 };
56+
return { minWidth: 0, flex: 1 }
5857
}}
5958
>
6059
<Typography
6160
color="text.secondary"
6261
variant="overline"
6362
sx={{
64-
display: "block",
65-
overflow: "hidden",
66-
textOverflow: "ellipsis",
67-
whiteSpace: "nowrap",
63+
display: 'block',
64+
overflow: 'hidden',
65+
textOverflow: 'ellipsis',
66+
whiteSpace: 'nowrap',
6867
}}
6968
>
7069
{item.name}
7170
</Typography>
7271
<Typography
7372
variant="h6"
74-
sx={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}
73+
sx={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}
7574
>
76-
{isFetching ? <Skeleton width={"100%"} /> : item.data}
75+
{isFetching ? <Skeleton width={'100%'} /> : item.data}
7776
</Typography>
7877
</Box>
7978
</Tooltip>
8079
) : (
8180
<Box
8281
sx={() => {
8382
if (!item?.icon) {
84-
return { pl: 2, minWidth: 0, flex: 1 };
83+
return { pl: 2, minWidth: 0, flex: 1 }
8584
}
86-
return { minWidth: 0, flex: 1 };
85+
return { minWidth: 0, flex: 1 }
8786
}}
8887
>
8988
<Typography
9089
color="text.secondary"
9190
variant="overline"
9291
sx={{
93-
display: "block",
94-
overflow: "hidden",
95-
textOverflow: "ellipsis",
96-
whiteSpace: "nowrap",
92+
display: 'block',
93+
overflow: 'hidden',
94+
textOverflow: 'ellipsis',
95+
whiteSpace: 'nowrap',
9796
}}
9897
>
9998
{item.name}
10099
</Typography>
101100
<Typography
102101
variant="h6"
103-
sx={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}
102+
sx={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}
104103
>
105-
{isFetching ? <Skeleton width={"100%"} /> : item.data}
104+
{isFetching ? <Skeleton width={'100%'} /> : item.data}
106105
</Typography>
107106
</Box>
108107
)}
@@ -111,17 +110,17 @@ export const CippInfoBar = ({ data, isFetching }) => {
111110
{item.offcanvas && (
112111
<>
113112
<CippOffCanvas
114-
title={item?.offcanvas?.title || "Details"}
113+
title={item?.offcanvas?.title || 'Details'}
115114
size="md"
116115
visible={visibleIndex === index}
117116
onClose={() => setVisibleIndex(null)}
118117
>
119118
<Box
120119
sx={{
121-
overflowY: "auto",
122-
maxHeight: "100%",
123-
display: "flex",
124-
flexDirection: "column",
120+
overflowY: 'auto',
121+
maxHeight: '100%',
122+
display: 'flex',
123+
flexDirection: 'column',
125124
}}
126125
>
127126
<Grid container spacing={1}>
@@ -140,9 +139,9 @@ export const CippInfoBar = ({ data, isFetching }) => {
140139
</CippOffCanvas>
141140
</>
142141
)}
143-
</>
142+
</Fragment>
144143
))}
145144
</Grid>
146145
</Card>
147-
);
148-
};
146+
)
147+
}

0 commit comments

Comments
 (0)