Files
Checkmate/client/src/Components/design-elements/TextLink.tsx
T

43 lines
893 B
TypeScript
Raw Normal View History

2026-02-06 20:53:48 +00:00
import Typography from "@mui/material/Typography";
import Stack from "@mui/material/Stack";
import type { StackProps } from "@mui/material/Stack";
import Link from "@mui/material/Link";
import { Link as RouterLink } from "react-router-dom";
import { useTheme } from "@mui/material/styles";
interface TextLinkProps extends StackProps {
text: string;
linkText: string;
href: string;
2026-02-20 17:20:43 +00:00
target?: "_self" | "_blank" | "_parent" | "_top";
2026-02-06 20:53:48 +00:00
}
export const TextLink = ({
text,
linkText,
href,
target = "_self",
...props
}: TextLinkProps) => {
const theme = useTheme();
return (
<Stack
direction="row"
gap={theme.spacing(4)}
{...props}
>
<Typography>{text}</Typography>
<Link
color="primary"
to={href}
component={RouterLink}
target={target}
2026-02-20 17:20:43 +00:00
{...(target === "_blank" && { rel: "noopener noreferrer" })}
2026-02-06 20:53:48 +00:00
>
{linkText}
</Link>
</Stack>
);
};