diff --git a/src/dzeio/Link/index.tsx b/src/dzeio/Link/index.tsx index e1ed69a..701a34c 100644 --- a/src/dzeio/Link/index.tsx +++ b/src/dzeio/Link/index.tsx @@ -24,7 +24,7 @@ interface Props { export default class Link extends React.Component { 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 ( diff --git a/src/dzeio/Text/index.tsx b/src/dzeio/Text/index.tsx index d0fc939..25e5843 100644 --- a/src/dzeio/Text/index.tsx +++ b/src/dzeio/Text/index.tsx @@ -12,7 +12,6 @@ interface Props { export default class Text extends React.Component { - public render() { const classes = buildClassName( css.text, @@ -23,16 +22,10 @@ export default class Text extends React.Component { this.props.className ) - switch (this.props.type || 'p') { - case 'h1': return (

{this.props.children}

) - case 'h2': return (

{this.props.children}

) - case 'h3': return (

{this.props.children}

) - case 'h4': return (

{this.props.children}

) - case 'h5': return (
{this.props.children}
) - case 'h6': return (
{this.props.children}
) - case 'em': return (

{this.props.children}

) - case 'span': return ({this.props.children}) - default: return (

{this.props.children}

) + if (this.props.type === 'em') { + return (

{this.props.children}

) } + + return React.createElement(this.props.type || 'p', {className: classes}) } }