mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-01 01:18:10 +02:00
Upgrades biome to 1.6.1, and updates husky pre-commit hook. Most changes here are making type imports explicit.
25 lines
706 B
TypeScript
25 lines
706 B
TypeScript
import { Link } from '@mui/material';
|
|
import type { AnchorHTMLAttributes, ComponentProps } from 'react';
|
|
import ReactMarkdown from 'react-markdown';
|
|
import { useNavigate } from 'react-router-dom';
|
|
|
|
const LinkRenderer = ({
|
|
href = '',
|
|
children,
|
|
}: AnchorHTMLAttributes<HTMLAnchorElement>) => {
|
|
const navigate = useNavigate();
|
|
|
|
if (href.startsWith('/'))
|
|
return <Link onClick={() => navigate(href)}>{children}</Link>;
|
|
|
|
return (
|
|
<Link href={href} target='_blank' rel='noreferrer'>
|
|
{children}
|
|
</Link>
|
|
);
|
|
};
|
|
|
|
export const Markdown = (props: ComponentProps<typeof ReactMarkdown>) => (
|
|
<ReactMarkdown components={{ a: LinkRenderer }} {...props} />
|
|
);
|