Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 1 | // Copyright 2019 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | import {LitElement, html} from 'lit-element'; |
| 6 | import {SHARED_STYLES} from 'shared/shared-styles.js'; |
| 7 | |
| 8 | /** |
| 9 | * `<mr-hotlist-link>` |
| 10 | * |
| 11 | * Displays a link to a hotlist. |
| 12 | * |
| 13 | */ |
| 14 | export class MrHotlistLink extends LitElement { |
| 15 | /** @override */ |
| 16 | static get styles() { |
| 17 | return SHARED_STYLES; |
| 18 | } |
| 19 | |
| 20 | /** @override */ |
| 21 | render() { |
| 22 | if (!this.hotlist) return html``; |
| 23 | return html` |
| 24 | <a |
| 25 | href="/u/${this.hotlist.ownerRef && this.hotlist.ownerRef.userId}/hotlists/${this.hotlist.name}" |
| 26 | title="${this.hotlist.name} - ${this.hotlist.summary}" |
| 27 | > |
| 28 | ${this.hotlist.name}</a> |
| 29 | `; |
| 30 | } |
| 31 | |
| 32 | /** @override */ |
| 33 | static get properties() { |
| 34 | return { |
| 35 | hotlist: {type: Object}, |
| 36 | }; |
| 37 | } |
| 38 | } |
| 39 | customElements.define('mr-hotlist-link', MrHotlistLink); |