63 |
68 |
69 | ${this.tabs.map((tabContent) => this.renderTabContent(tabContent, tabContent.id === this.selectedTabId))}
70 |
71 |
72 | `;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/components/teaser-list-component.ts:
--------------------------------------------------------------------------------
1 | import { LitElement, html } from 'lit';
2 | import { customElement, property } from 'lit/decorators.js';
3 | import { styles } from '../styles/teaser-list-component.js';
4 |
5 | export interface Teaser {
6 | description: string;
7 | }
8 |
9 | @customElement('teaser-list-component')
10 | export class TeaserListComponent extends LitElement {
11 | static override styles = [styles];
12 |
13 | @property({ type: Array })
14 | teasers: Teaser[] = [];
15 |
16 | @property({ type: String })
17 | heading: string | undefined = undefined;
18 |
19 | @property({ type: String })
20 | actionLabel: string | undefined = undefined;
21 |
22 | @property({ type: Boolean })
23 | alwaysRow = false;
24 |
25 | @property({ type: Boolean })
26 | clickable = false;
27 |
28 | // Handle the click on a default prompt
29 | handleTeaserClick(teaser: Teaser, event?: Event): void {
30 | event?.preventDefault();
31 | const teaserClickEvent = new CustomEvent('teaser-click', {
32 | detail: {
33 | question: teaser.description,
34 | },
35 | bubbles: true,
36 | composed: true,
37 | });
38 | this.dispatchEvent(teaserClickEvent);
39 | }
40 |
41 | renderClickableTeaser(teaser: Teaser) {
42 | return html`
43 |