Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 1 | // Copyright 2020 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 page from 'page'; |
| 6 | import {LitElement, html, css} from 'lit-element'; |
| 7 | |
| 8 | /** |
| 9 | * `<mr-issue-entry-page>` |
| 10 | * |
| 11 | * This is the main details section for a given issue. |
| 12 | * |
| 13 | */ |
| 14 | export class MrIssueEntryPage extends LitElement { |
| 15 | /** @override */ |
| 16 | static get styles() { |
| 17 | return css` |
| 18 | :host { |
| 19 | margin: 0; |
| 20 | } |
| 21 | `; |
| 22 | } |
| 23 | |
| 24 | /** @override */ |
| 25 | static get properties() { |
| 26 | return { |
| 27 | userDisplayName: {type: String}, |
| 28 | loginUrl: {type: String}, |
| 29 | }; |
| 30 | } |
| 31 | |
| 32 | /** @override */ |
| 33 | constructor() { |
| 34 | super(); |
| 35 | |
| 36 | /* dependency injection for testing purpose */ |
| 37 | this._page = page; |
| 38 | } |
| 39 | |
| 40 | /** @override */ |
| 41 | connectedCallback() { |
| 42 | super.connectedCallback(); |
| 43 | if (!this.userDisplayName) { |
| 44 | this._page(this.loginUrl); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | /** @override */ |
| 49 | render() { |
| 50 | return html` |
| 51 | <div>SPA issue entry page place holder</div> |
| 52 | `; |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | customElements.define('mr-issue-entry-page', MrIssueEntryPage); |