Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 4x 4x 4x 4x 4x 4x 82x 82x 82x 4x | import React, { MouseEventHandler } from 'react';
import { Link as MuiLink, LinkProps as MuiLinkProps } from '@mui/material';
import { cx } from '@emotion/css';
import { LinkTarget, LinkUnderline } from './types';
import { LinkBase } from './styles';
export interface LinkProps extends MuiLinkProps {
readonly disabled?: boolean;
readonly target?: LinkTarget;
readonly underline?: LinkUnderline;
readonly onClick?: MouseEventHandler<HTMLAnchorElement>;
readonly className?: string;
readonly href?: string;
readonly children?: string | React.ReactElement;
}
const Link: React.FunctionComponent<LinkProps> = ({
className,
disabled = false,
children,
onClick,
target = LinkTarget.Content,
...materialLinkProps
}) => {
const external = target === LinkTarget.External;
const props = {
...materialLinkProps,
className: cx(LinkBase(), className),
target,
onClick: disabled ? undefined : onClick,
rel: external ? 'noopener noreferrer' : undefined,
};
return <MuiLink {...props} data-testid={'link'} >{children}</MuiLink>;
};
export { Link };
|