-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use announce helper in avatar-group (#3239)
- Loading branch information
1 parent
e943af9
commit 43c2474
Showing
5 changed files
with
85 additions
and
62 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,36 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Avatar group</title> | ||
|
||
<script type="module"> | ||
import '@vaadin/avatar-group'; | ||
|
||
const group = document.querySelector('vaadin-avatar-group'); | ||
group.items = [{ name: 'AA' }, { name: 'BB' }, { name: 'CC' }]; | ||
|
||
document.querySelector('#add').addEventListener('click', () => { | ||
const alphabet = 'abcdefghijklmnopqrstuvwxyz'; | ||
const randomChar = alphabet[Math.floor(Math.random() * alphabet.length)]; | ||
group.items = [...group.items, { name: randomChar.toUpperCase().repeat(2) }]; | ||
}); | ||
|
||
document.querySelector('#remove').addEventListener('click', () => { | ||
const items = [...group.items].splice(0, group.items.length - 1); | ||
group.items = items; | ||
}); | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<vaadin-avatar-group></vaadin-avatar-group> | ||
|
||
<p> | ||
<button id="add">Add item</button> | ||
<button id="remove">Remove item</button> | ||
</p> | ||
</body> | ||
</html> |
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
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