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';
type Props = {
extra?: Record<string, string>;
class?: string;
text: string;
url: string;
};
export default class ExternalAnchor extends Component<Props> {
render() {
const {extra, text, url} = this.props;
return html`
<a href="${url}" target="_blank" rel="noopener noreferrer" ...${extra}>
${text}
<a
class="${this.props.class}"
href="${this.props.url}"
rel="noopener noreferrer"
target="_blank"
>
${this.props.text}
</a>
`;
}