Misc changes to Link

Signed-off-by: Florian BOUILLON <florian.bouillon@delta-wings.net>
This commit is contained in:
Florian Bouillon 2021-03-30 16:59:04 +02:00
parent 40ce098d63
commit 2bfcc6f4ad

View File

@ -6,13 +6,18 @@ import css from './Link.module.styl'
import { buildClassName } from '../Util' import { buildClassName } from '../Util'
interface Props { interface Props {
linkProps?: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>
href: string href: string
children?: React.ReactNode children?: React.ReactNode
className?: string className?: string
/** /**
* Override external detection system * Remove styling
*/ */
noStyle?: boolean noStyle?: boolean
/**
* Override external detection system
*/
external?: boolean external?: boolean
} }
@ -24,6 +29,7 @@ export default class Link extends React.Component<Props> {
// external link // external link
return ( return (
<a <a
{...this.props.linkProps}
className={buildClassName(this.props.className, [css.link, !this.props.noStyle])} className={buildClassName(this.props.className, [css.link, !this.props.noStyle])}
href={this.props.href} href={this.props.href}
rel="noreferrer nofollow" rel="noreferrer nofollow"
@ -36,6 +42,7 @@ export default class Link extends React.Component<Props> {
return ( return (
<NextLink href={this.props.href}> <NextLink href={this.props.href}>
<a <a
{...this.props.linkProps}
className={buildClassName(this.props.className, [css.link, !this.props.noStyle])} className={buildClassName(this.props.className, [css.link, !this.props.noStyle])}
>{this.props.children}</a> >{this.props.children}</a>
</NextLink> </NextLink>