-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(list): add support for displaying pictures in the list items
- Loading branch information
Showing
4 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
import { ListItem } from '@limetech/lime-elements'; | ||
import { Component, h, State } from '@stencil/core'; | ||
|
||
/** | ||
* List with Pictures and Icons | ||
* | ||
* :::note | ||
* While it's technically possible to display both images and icons simultaneously | ||
* for each list item, we recommend against using identical icons across all items. | ||
* Repeating the same icon for every list item adds unnecessary visual clutter | ||
* without providing additional value. | ||
* | ||
* Icons, like images, should serve to help users quickly differentiate between | ||
* list items. They are most effective when each icon uniquely identifies | ||
* the type or category of its list item. | ||
* ::: | ||
*/ | ||
@Component({ | ||
tag: 'limel-example-list-pictures', | ||
shadow: true, | ||
}) | ||
export class PictureListExample { | ||
private items: Array<ListItem<number>> = [ | ||
{ | ||
text: 'Lucy Chyzhova', | ||
secondaryText: 'UX Designer', | ||
value: 1, | ||
icon: { | ||
name: 'santas_hat', | ||
color: 'rgb(var(--color-coral-default))', | ||
}, | ||
image: { | ||
src: 'https://lundalogik.github.io/lime-elements/780af2a6-d3d1-4593-8642-f03210d09271.png', | ||
alt: 'A picture of Lucy Chyzhova, UX designer at Lime Technologies', | ||
}, | ||
}, | ||
{ | ||
text: 'Kiarokh Moattar', | ||
secondaryText: 'Product Designer', | ||
value: 2, | ||
icon: { | ||
name: 'party_hat', | ||
color: 'rgb(var(--color-pink-default))', | ||
}, | ||
image: { | ||
src: 'https://lundalogik.github.io/lime-elements/2e86c284-d190-4c41-8da2-4de50103a0cd.png', | ||
alt: 'A picture of Kiarokh Moattar, Product Designer at Lime Technologies', | ||
}, | ||
}, | ||
{ | ||
text: 'Adrian Schmidt', | ||
secondaryText: 'Engineer', | ||
value: 3, | ||
icon: 'viking_helmet', | ||
image: { | ||
src: 'https://lundalogik.github.io/lime-elements/0e6f74c0-11d9-465b-aac6-44f33da3cb7c.png', | ||
alt: 'A picture of Adrian Schmidt, Head of Smooth Operations at Lime Technologies', | ||
}, | ||
}, | ||
{ | ||
text: 'Befkadu Degefa', | ||
secondaryText: 'Engineer', | ||
value: 4, | ||
icon: { | ||
name: 'bowler_hat', | ||
color: 'rgb(var(--color-sky-default))', | ||
}, | ||
}, | ||
]; | ||
|
||
@State() | ||
private badgeIcons: boolean = false; | ||
|
||
@State() | ||
private hasStripedRows: boolean = true; | ||
|
||
public render() { | ||
return [ | ||
<limel-list | ||
items={this.items} | ||
type="selectable" | ||
badgeIcons={this.badgeIcons} | ||
class={this.hasStripedRows ? 'has-striped-rows' : ''} | ||
/>, | ||
<limel-example-controls> | ||
<limel-checkbox | ||
checked={this.badgeIcons} | ||
label="badge icons" | ||
onChange={this.setBadgeIcons} | ||
/> | ||
<limel-checkbox | ||
checked={this.hasStripedRows} | ||
label="striped rows" | ||
onChange={this.setHasStripedRows} | ||
/> | ||
</limel-example-controls>, | ||
]; | ||
} | ||
|
||
private setBadgeIcons = (event: CustomEvent<boolean>) => { | ||
event.stopPropagation(); | ||
this.badgeIcons = event.detail; | ||
}; | ||
|
||
private setHasStripedRows = (event: CustomEvent<boolean>) => { | ||
event.stopPropagation(); | ||
this.hasStripedRows = event.detail; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters