|
| 1 | +import { LimelPickerCustomEvent, ListItem } from '@limetech/lime-elements'; |
| 2 | +import { Component, h, State } from '@stencil/core'; |
| 3 | + |
| 4 | +/** |
| 5 | + * With pictures |
| 6 | + */ |
| 7 | +@Component({ |
| 8 | + tag: 'limel-example-picker-pictures', |
| 9 | + shadow: true, |
| 10 | +}) |
| 11 | +export class PickerPicturesExample { |
| 12 | + @State() |
| 13 | + private selectedItems: Array<ListItem<number>> = []; |
| 14 | + |
| 15 | + private allItems: Array<ListItem<number>> = [ |
| 16 | + { |
| 17 | + text: 'Lucy Chyzhova', |
| 18 | + secondaryText: 'UX Designer', |
| 19 | + value: 1, |
| 20 | + icon: { |
| 21 | + name: 'santas_hat', |
| 22 | + color: 'rgb(var(--color-coral-default))', |
| 23 | + }, |
| 24 | + image: { |
| 25 | + src: 'https://lundalogik.github.io/lime-elements/780af2a6-d3d1-4593-8642-f03210d09271.png', |
| 26 | + alt: 'A picture of Lucy Chyzhova, UX designer at Lime Technologies', |
| 27 | + }, |
| 28 | + }, |
| 29 | + { |
| 30 | + text: 'Kiarokh Moattar', |
| 31 | + secondaryText: 'Product Designer', |
| 32 | + value: 2, |
| 33 | + icon: { |
| 34 | + name: 'party_hat', |
| 35 | + color: 'rgb(var(--color-pink-default))', |
| 36 | + }, |
| 37 | + image: { |
| 38 | + src: 'https://lundalogik.github.io/lime-elements/2e86c284-d190-4c41-8da2-4de50103a0cd.png', |
| 39 | + alt: 'A picture of Kiarokh Moattar, Product Designer at Lime Technologies', |
| 40 | + }, |
| 41 | + }, |
| 42 | + { |
| 43 | + text: 'Adrian Schmidt', |
| 44 | + secondaryText: 'Engineer', |
| 45 | + value: 3, |
| 46 | + icon: 'viking_helmet', |
| 47 | + image: { |
| 48 | + src: 'https://lundalogik.github.io/lime-elements/0e6f74c0-11d9-465b-aac6-44f33da3cb7c.png', |
| 49 | + alt: 'A picture of Adrian Schmidt, Head of Smooth Operations at Lime Technologies', |
| 50 | + }, |
| 51 | + }, |
| 52 | + { |
| 53 | + text: 'Befkadu Degefa', |
| 54 | + secondaryText: 'Engineer', |
| 55 | + value: 4, |
| 56 | + icon: { |
| 57 | + name: 'bowler_hat', |
| 58 | + color: 'rgb(var(--color-sky-default))', |
| 59 | + }, |
| 60 | + }, |
| 61 | + ]; |
| 62 | + |
| 63 | + public render() { |
| 64 | + return [ |
| 65 | + <limel-picker |
| 66 | + label="Favorite awesomenaut" |
| 67 | + value={this.selectedItems} |
| 68 | + searchLabel={'Search your awesomenaut'} |
| 69 | + multiple={true} |
| 70 | + allItems={this.allItems} |
| 71 | + emptyResultMessage="No matching awesomenauts found" |
| 72 | + onChange={this.onChange} |
| 73 | + onInteract={this.onInteract} |
| 74 | + />, |
| 75 | + <limel-example-value value={this.selectedItems} />, |
| 76 | + ]; |
| 77 | + } |
| 78 | + |
| 79 | + private onChange = ( |
| 80 | + event: LimelPickerCustomEvent<Array<ListItem<number>>>, |
| 81 | + ) => { |
| 82 | + this.selectedItems = [...event.detail]; |
| 83 | + }; |
| 84 | + |
| 85 | + private onInteract = (event: LimelPickerCustomEvent<ListItem<number>>) => { |
| 86 | + console.log('Value interacted with:', event.detail); |
| 87 | + }; |
| 88 | +} |
0 commit comments