mirror of
https://github.com/dzeiocom/components.git
synced 2025-04-22 19:02:15 +00:00
Fixed External link
Signed-off-by: Florian BOUILLON <florian.bouillon@delta-wings.net>
This commit is contained in:
parent
8186284ded
commit
68939d8390
@ -24,7 +24,7 @@ interface Props {
|
|||||||
export default class Link extends React.Component<Props> {
|
export default class Link extends React.Component<Props> {
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
const external = this.props.external ?? !this.props.href.startsWith('/')
|
const external = this.props.external ?? this.props.href.startsWith('http')
|
||||||
if (external) {
|
if (external) {
|
||||||
// external link
|
// external link
|
||||||
return (
|
return (
|
||||||
|
@ -12,7 +12,6 @@ interface Props {
|
|||||||
|
|
||||||
export default class Text extends React.Component<Props> {
|
export default class Text extends React.Component<Props> {
|
||||||
|
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
const classes = buildClassName(
|
const classes = buildClassName(
|
||||||
css.text,
|
css.text,
|
||||||
@ -23,16 +22,10 @@ export default class Text extends React.Component<Props> {
|
|||||||
this.props.className
|
this.props.className
|
||||||
)
|
)
|
||||||
|
|
||||||
switch (this.props.type || 'p') {
|
if (this.props.type === 'em') {
|
||||||
case 'h1': return (<h1 className={classes}>{this.props.children}</h1>)
|
return (<p className={classes}><em>{this.props.children}</em></p>)
|
||||||
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>)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return React.createElement(this.props.type || 'p', {className: classes})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user