1
Fork 0

Change the ExternalAnchor to accept a direct class prop instead of extras.

This commit is contained in:
Bauke 2022-01-04 00:07:30 +01:00
parent fd3faa4807
commit f28ef60faf
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 8 additions and 5 deletions

View File

@ -1,18 +1,21 @@
import {html, Component} from 'htm/preact'; import {html, Component} from 'htm/preact';
type Props = { type Props = {
extra?: Record<string, string>; class?: string;
text: string; text: string;
url: string; url: string;
}; };
export default class ExternalAnchor extends Component<Props> { export default class ExternalAnchor extends Component<Props> {
render() { render() {
const {extra, text, url} = this.props;
return html` return html`
<a href="${url}" target="_blank" rel="noopener noreferrer" ...${extra}> <a
${text} class="${this.props.class}"
href="${this.props.url}"
rel="noopener noreferrer"
target="_blank"
>
${this.props.text}
</a> </a>
`; `;
} }