Skip to content

Commit 990ec48

Browse files
committed
refactor: test
feat: new tests of AppXxx components refactor: AppIcon feat: new utils
1 parent 947f83f commit 990ec48

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/components/AppLink/AppLink.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import { Link as RouterLink } from 'react-router-dom';
33
import MuiLink, { LinkProps as MuiLinkProps } from '@mui/material/Link';
44
import { APP_LINK_COLOR, APP_LINK_UNDERLINE } from '../config';
55

6-
interface Props extends MuiLinkProps {
6+
export const EXTERNAL_LINK_PROPS = {
7+
target: '_blank',
8+
rel: 'noopener noreferrer',
9+
};
10+
11+
export interface AppLinkProps extends MuiLinkProps {
712
children: ReactNode;
813
to?: string;
914
href?: string;
@@ -18,7 +23,7 @@ interface Props extends MuiLinkProps {
1823
* @param {string} [href] - external link URI
1924
* @param {boolean} [openInNewTab] - link will be opened in new tab when true
2025
*/
21-
const AppLink = forwardRef<any, Props>(
26+
const AppLink = forwardRef<any, AppLinkProps>(
2227
(
2328
{
2429
children,
@@ -34,7 +39,7 @@ const AppLink = forwardRef<any, Props>(
3439
const propsToRender = {
3540
color,
3641
underline,
37-
...(openInNewTab ? { target: '_blank', rel: 'noreferrer noopener' } : {}),
42+
...(openInNewTab && EXTERNAL_LINK_PROPS),
3843
...restOfProps,
3944
};
4045
return href ? (

0 commit comments

Comments
 (0)