Fixed External link

Signed-off-by: Florian BOUILLON <florian.bouillon@delta-wings.net>
This commit is contained in:
Florian Bouillon 2021-03-31 14:38:33 +02:00
parent 8186284ded
commit 68939d8390
2 changed files with 5 additions and 12 deletions

View File

@ -24,7 +24,7 @@ interface Props {
export default class Link extends React.Component<Props> {
public render() {
const external = this.props.external ?? !this.props.href.startsWith('/')
const external = this.props.external ?? this.props.href.startsWith('http')
if (external) {
// external link
return (

View File

@ -12,7 +12,6 @@ interface Props {
export default class Text extends React.Component<Props> {
public render() {
const classes = buildClassName(
css.text,
@ -23,16 +22,10 @@ export default class Text extends React.Component<Props> {
this.props.className
)
switch (this.props.type || 'p') {
case 'h1': return (<h1 className={classes}>{this.props.children}</h1>)
case 'h2': return (<h2 className={classes}>{this.props.children}</h2>)
case 'h3': return (<h3 className={classes}>{this.props.children}</h3>)
case 'h4': return (<h4 className={classes}>{this.props.children}</h4>)
case 'h5': return (<h5 className={classes}>{this.props.children}</h5>)
case 'h6': return (<h6 className={classes}>{this.props.children}</h6>)
case 'em': return (<p className={classes}><em>{this.props.children}</em></p>)
case 'span': return (<span className={classes}>{this.props.children}</span>)
default: return (<p className={classes}>{this.props.children}</p>)
if (this.props.type === 'em') {
return (<p className={classes}><em>{this.props.children}</em></p>)
}
return React.createElement(this.props.type || 'p', {className: classes})
}
}