Skip to content

Commit 814fe0a

Browse files
committed
Improve layout and text overflow handling in Cipp cards
Added padding and minWidth to CippBannerListCard and enhanced CippInfoBar with better flexbox usage and text overflow handling. Typography elements now use ellipsis and nowrap to prevent overflow, improving UI consistency and readability.
1 parent a400395 commit 814fe0a

File tree

2 files changed

+39
-9
lines changed

2 files changed

+39
-9
lines changed

src/components/CippCards/CippBannerListCard.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export const CippBannerListCard = (props) => {
116116
</Box>
117117

118118
{/* Main Text and Subtext */}
119-
<Box sx={{ flex: 1, minWidth: 0 }}>
119+
<Box sx={{ flex: 1, minWidth: 0, pr: 2 }}>
120120
<Typography
121121
color="text.primary"
122122
variant="h6"

src/components/CippCards/CippInfoBar.jsx

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,13 @@ export const CippInfoBar = ({ data, isFetching }) => {
3737
},
3838
}}
3939
>
40-
<Stack alignItems="center" direction="row" spacing={2} sx={{ p: 2 }}>
40+
<Stack alignItems="center" direction="row" spacing={2} sx={{ p: 2, minWidth: 0 }}>
4141
{item?.icon && (
42-
<SvgIcon color={item.color ? item.color : "primary"} fontSize="small">
42+
<SvgIcon
43+
color={item.color ? item.color : "primary"}
44+
fontSize="small"
45+
sx={{ flexShrink: 0 }}
46+
>
4347
{item.icon}
4448
</SvgIcon>
4549
)}
@@ -48,14 +52,27 @@ export const CippInfoBar = ({ data, isFetching }) => {
4852
<Box
4953
sx={() => {
5054
if (!item?.icon) {
51-
return { pl: 2 };
55+
return { pl: 2, minWidth: 0, flex: 1 };
5256
}
57+
return { minWidth: 0, flex: 1 };
5358
}}
5459
>
55-
<Typography color="text.secondary" variant="overline">
60+
<Typography
61+
color="text.secondary"
62+
variant="overline"
63+
sx={{
64+
display: "block",
65+
overflow: "hidden",
66+
textOverflow: "ellipsis",
67+
whiteSpace: "nowrap",
68+
}}
69+
>
5670
{item.name}
5771
</Typography>
58-
<Typography variant="h6">
72+
<Typography
73+
variant="h6"
74+
sx={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}
75+
>
5976
{isFetching ? <Skeleton width={"100%"} /> : item.data}
6077
</Typography>
6178
</Box>
@@ -64,14 +81,27 @@ export const CippInfoBar = ({ data, isFetching }) => {
6481
<Box
6582
sx={() => {
6683
if (!item?.icon) {
67-
return { pl: 2 };
84+
return { pl: 2, minWidth: 0, flex: 1 };
6885
}
86+
return { minWidth: 0, flex: 1 };
6987
}}
7088
>
71-
<Typography color="text.secondary" variant="overline">
89+
<Typography
90+
color="text.secondary"
91+
variant="overline"
92+
sx={{
93+
display: "block",
94+
overflow: "hidden",
95+
textOverflow: "ellipsis",
96+
whiteSpace: "nowrap",
97+
}}
98+
>
7299
{item.name}
73100
</Typography>
74-
<Typography variant="h6">
101+
<Typography
102+
variant="h6"
103+
sx={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}
104+
>
75105
{isFetching ? <Skeleton width={"100%"} /> : item.data}
76106
</Typography>
77107
</Box>

0 commit comments

Comments
 (0)