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