import { Box, IconButton, Link } from "@mui/material";
import { IconExternalLink } from "@intersect.mbo/intersectmbo.org-icons-set";
import { Typography } from "../Atoms/Typography";
import CopyButton from "../Atoms/CopyButton";
import { useModal } from "../../contexts/modal";
interface GovernanceActionElementProps {
title: string;
type: string;
content: string;
isCopyable?: boolean;
dataTestId?: string;
}
export default function GovernanceActionElement({
title,
type,
content,
isCopyable = false,
dataTestId,
}: GovernanceActionElementProps) {
const { openModal } = useModal();
if (!content) return;
const contentTypographyStyles = {
fontSize: 16,
fontWeight: 400,
color: "primaryBlue",
wordBreak: "break-word",
overflow: "hidden",
padding: 0,
};
const contentContainerStyles = {
width: "100%",
display: "flex",
flexDirection: "row",
alignItems: "center",
gap: 1,
};
const renderContent = () => {
if (type === "text") {
return (
{content}
{isCopyable && }
);
}
if (type === "link") {
return (
{
openModal({
type: "externalLink",
state: {
externalLink: content,
},
});
}}
sx={{ ...contentContainerStyles, cursor: "pointer" }}
style={{ textDecoration: "none" }}
>
{content}
);
}
return null;
};
return (
{title}
{renderContent()}
);
}