Spaces:
Running
Running
File size: 884 Bytes
b9fe2dd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
import {
LitElement,
html,
css,
} from 'https://cdn.jsdelivr.net/gh/lit/dist@3/core/lit-core.min.js';
class CitationComponent extends LitElement {
static styles = css`
a {
display: block;
text-decoration: none;
color: var(--sys-on-surface);
}
.container {
background: var(--sys-surface-container-high);
border-radius: 12px;
}
.container:hover {
background: var(--sys-surface-container-highest);
}
`;
static properties = {
url: {type: String},
};
constructor() {
super();
this.url = '';
}
render() {
return html`
<a class="container" href="${this.url}" target="_blank">
<slot></slot>
</a>
`;
}
_onClick() {
window.open(this.url, '_blank');
console.log('open url', this.url);
}
}
customElements.define('citation-component', CitationComponent);
|