-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Copy pathindex.ts
51 lines (43 loc) · 1.61 KB
/
index.ts
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
50
51
import { LitElement, html } from 'lit'
import { property } from 'lit/decorators.js'
import '../../components/wui-icon/index.js'
import '../../components/wui-image/index.js'
import '../../components/wui-text/index.js'
import '../../layout/wui-flex/index.js'
import { elementStyles, resetStyles } from '../../utils/ThemeUtil.js'
import { customElement } from '../../utils/WebComponentsUtil.js'
import styles from './styles.js'
@customElement('wui-compatible-network')
export class WuiCompatibleNetwork extends LitElement {
public static override styles = [resetStyles, elementStyles, styles]
// -- State & Properties -------------------------------- //
@property({ type: Array }) networkImages: string[] = ['']
@property() public text = ''
// -- Render -------------------------------------------- //
public override render() {
return html`
<button>
<wui-text variant="small-400" color="fg-200">${this.text}</wui-text>
<wui-flex gap="3xs" alignItems="center">
${this.networksTemplate()}
<wui-icon name="chevronRight" size="sm" color="fg-200"></wui-icon>
</wui-flex>
</button>
`
}
// -- Private ------------------------------------------- //
private networksTemplate() {
const slicedNetworks = this.networkImages.slice(0, 5)
return html` <wui-flex class="networks">
${slicedNetworks?.map(
network =>
html` <wui-flex class="network-icon"> <wui-image src=${network}></wui-image> </wui-flex>`
)}
</wui-flex>`
}
}
declare global {
interface HTMLElementTagNameMap {
'wui-compatible-network': WuiCompatibleNetwork
}
}