File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,12 @@ import { Link as RouterLink } from 'react-router-dom';
33import MuiLink , { LinkProps as MuiLinkProps } from '@mui/material/Link' ;
44import { 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 ? (
You can’t perform that action at this time.
0 commit comments