-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #863 from IntersectMBO/chore/add-supported-links
chore/add-supported-links
- Loading branch information
Showing
5 changed files
with
93 additions
and
85 deletions.
There are no files selected for viewing
104 changes: 51 additions & 53 deletions
104
govtool/frontend/src/components/molecules/GovernanceActionDetailsCardLinks.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,64 @@ | ||
import { Box } from "@mui/material"; | ||
|
||
import { Typography } from "@atoms"; | ||
import { ICONS } from "@consts"; | ||
import { useModal } from "@context"; | ||
import { useScreenDimension, useTranslation } from "@hooks"; | ||
import { LinkWithIcon } from "@molecules"; | ||
import { ICONS } from "@/consts"; | ||
import { useModal } from "@/context"; | ||
|
||
// TODO: When BE is ready, pass links as props | ||
const LINKS = [ | ||
"https://docs.sanchogov.tools/support/get-help-in-discord", | ||
"https://docs.sanchogov.tools/how-to-use-the-govtool/prerequsites", | ||
"https://docs.sanchogov.tools/faqs", | ||
"https://docs.sanchogov.tools/", | ||
]; | ||
|
||
export const GovernanceActionDetailsCardLinks = () => { | ||
export const GovernanceActionDetailsCardLinks = ({ | ||
links, | ||
}: { | ||
links?: string[]; | ||
}) => { | ||
const { isMobile } = useScreenDimension(); | ||
const { t } = useTranslation(); | ||
const { openModal } = useModal(); | ||
|
||
return ( | ||
<> | ||
<Typography | ||
sx={{ | ||
fontSize: 14, | ||
fontWeight: 600, | ||
lineHeight: "20px", | ||
color: "neutralGray", | ||
overflow: "hidden", | ||
textOverflow: "ellipsis", | ||
whiteSpace: "nowrap", | ||
mb: 2, | ||
}} | ||
data-testid="supporting-links" | ||
> | ||
{t("govActions.supportingLinks")} | ||
</Typography> | ||
<Box | ||
sx={{ | ||
display: "grid", | ||
gridTemplateColumns: isMobile ? undefined : "1fr 1fr", | ||
columnGap: 2, | ||
rowGap: 2, | ||
}} | ||
> | ||
{LINKS.map((link) => ( | ||
<LinkWithIcon | ||
key={link} | ||
label={link} | ||
onClick={() => { | ||
openModal({ | ||
type: "externalLink", | ||
state: { | ||
externalLink: link, | ||
}, | ||
}); | ||
}} | ||
icon={<img alt="link" src={ICONS.link} />} | ||
cutWithEllipsis | ||
/> | ||
))} | ||
</Box> | ||
</> | ||
links && ( | ||
<> | ||
<Typography | ||
sx={{ | ||
fontSize: 14, | ||
fontWeight: 600, | ||
lineHeight: "20px", | ||
color: "neutralGray", | ||
overflow: "hidden", | ||
textOverflow: "ellipsis", | ||
whiteSpace: "nowrap", | ||
mb: 2, | ||
}} | ||
data-testid="supporting-links" | ||
> | ||
{t("govActions.supportingLinks")} | ||
</Typography> | ||
<Box | ||
sx={{ | ||
display: "grid", | ||
gridTemplateColumns: isMobile ? undefined : "1fr 1fr", | ||
columnGap: 2, | ||
rowGap: 2, | ||
}} | ||
> | ||
{links.map((link) => ( | ||
<LinkWithIcon | ||
key={link} | ||
label={link} | ||
onClick={() => { | ||
openModal({ | ||
type: "externalLink", | ||
state: { | ||
externalLink: link, | ||
}, | ||
}); | ||
}} | ||
icon={<img alt="link" src={ICONS.link} />} | ||
cutWithEllipsis | ||
/> | ||
))} | ||
</Box> | ||
</> | ||
) | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters