1
Fork 0
href-plus/source/ts/components/external-anchor.ts

20 lines
384 B
TypeScript

import {html, Component} from 'htm/preact';
type Props = {
extra?: Record<string, 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>
`;
}
}