Skip to content

Commit

Permalink
refactor: test
Browse files Browse the repository at this point in the history
feat: new tests of AppXxx components
refactor: AppIcon
feat: new utils
  • Loading branch information
karpolan committed Jul 27, 2023
1 parent 947f83f commit 990ec48
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/AppLink/AppLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import { Link as RouterLink } from 'react-router-dom';
import MuiLink, { LinkProps as MuiLinkProps } from '@mui/material/Link';
import { APP_LINK_COLOR, APP_LINK_UNDERLINE } from '../config';

interface Props extends MuiLinkProps {
export const EXTERNAL_LINK_PROPS = {
target: '_blank',
rel: 'noopener noreferrer',
};

export interface AppLinkProps extends MuiLinkProps {
children: ReactNode;
to?: string;
href?: string;
Expand All @@ -18,7 +23,7 @@ interface Props extends MuiLinkProps {
* @param {string} [href] - external link URI
* @param {boolean} [openInNewTab] - link will be opened in new tab when true
*/
const AppLink = forwardRef<any, Props>(
const AppLink = forwardRef<any, AppLinkProps>(
(
{
children,
Expand All @@ -34,7 +39,7 @@ const AppLink = forwardRef<any, Props>(
const propsToRender = {
color,
underline,
...(openInNewTab ? { target: '_blank', rel: 'noreferrer noopener' } : {}),
...(openInNewTab && EXTERNAL_LINK_PROPS),
...restOfProps,
};
return href ? (
Expand Down

0 comments on commit 990ec48

Please sign in to comment.