Skip to content

Commit 0c2f2aa

Browse files
committed
feat(#2391): display supporing links in columns
1 parent 1663f56 commit 0c2f2aa

File tree

2 files changed

+32
-34
lines changed

2 files changed

+32
-34
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ changes.
2323
### Changed
2424

2525
- Bump CSL version to 13.1.0 [Issue 2169](https://github.com/IntersectMBO/govtool/issues/2169)
26+
- Display supporting links below labels than in same row [Issue 2391](https://github.com/IntersectMBO/govtool/issues/2391)
2627

2728
### Removed
2829

govtool/frontend/src/components/molecules/GovernanceActionDetailsCardLinks.tsx

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ export const GovernanceActionDetailsCardLinks = ({
1010
}: {
1111
links?: Reference[];
1212
}) => {
13-
const { isMobile } = useScreenDimension();
13+
const { screenWidth } = useScreenDimension();
1414
const { t } = useTranslation();
1515
const { openModal } = useModal();
1616

17+
const isOneLine = screenWidth < 1600;
18+
1719
return (
1820
!!links?.length && (
1921
<>
@@ -32,42 +34,37 @@ export const GovernanceActionDetailsCardLinks = ({
3234
>
3335
{t("govActions.supportingLinks")}
3436
</Typography>
35-
<Box
36-
sx={{
37-
display: "grid",
38-
gridTemplateColumns: isMobile ? undefined : "1fr 1fr",
39-
columnGap: 2,
40-
rowGap: 2,
41-
}}
42-
>
43-
{links.map(({ uri, label }) => (
44-
<Box flexDirection={isMobile ? "column" : "row"} display="flex">
45-
{label && (
46-
<Typography
47-
data-testid={`${label}-${uri}-label`}
48-
sx={{
49-
fontWeight: 400,
50-
flex: 1,
51-
fontSize: 16,
52-
lineHeight: "24px",
53-
mr: 8,
54-
overflow: "hidden",
55-
width: "auto",
56-
whiteSpace: "nowrap",
57-
}}
58-
>
59-
{label}
60-
</Typography>
61-
)}
37+
{links.map(({ uri, label }) => (
38+
<Box display="flex" flexDirection="column" overflow="hidden">
39+
{label && (
6240
<Typography
41+
data-testid={`${label}-${uri}-label`}
6342
sx={{
64-
fontSize: 16,
6543
fontWeight: 400,
66-
maxWidth: "283px",
44+
flex: 1,
45+
fontSize: 16,
6746
lineHeight: "24px",
68-
whiteSpace: "nowrap",
47+
mr: 8,
6948
overflow: "hidden",
70-
textOverflow: "ellipsis",
49+
width: "auto",
50+
whiteSpace: "nowrap",
51+
}}
52+
>
53+
{label}
54+
</Typography>
55+
)}
56+
<Box display="flex" flexDirection="row">
57+
<Typography
58+
sx={{
59+
fontSize: 16,
60+
fontWeight: 400,
61+
maxWidth: isOneLine ? "283px" : "auto",
62+
lineHeight: "24px",
63+
...(isOneLine && {
64+
whiteSpace: "nowrap",
65+
overflow: "hidden",
66+
textOverflow: "ellipsis",
67+
}),
7168
color: "primaryBlue",
7269
}}
7370
>
@@ -92,8 +89,8 @@ export const GovernanceActionDetailsCardLinks = ({
9289
</Box>
9390
)}
9491
</Box>
95-
))}
96-
</Box>
92+
</Box>
93+
))}
9794
</>
9895
)
9996
);

0 commit comments

Comments
 (0)