Skip to content

Commit

Permalink
Add basic usage demo. Implement a search icons mechanism. Fixes #46
Browse files Browse the repository at this point in the history
  • Loading branch information
manolo committed Oct 11, 2017
1 parent 2eb9ed8 commit b21fdcf
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
43 changes: 30 additions & 13 deletions demo/icons-basic-demos.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
width: 100%;
}

.iconset-container {
margin-top: 1em;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
}

.icon-container {
margin: 24px 8px;
text-align: center;
Expand Down Expand Up @@ -43,18 +48,29 @@
}
</style>

<dom-repeat items="[[iconsets]]">
<template>
<dom-repeat id="wrapper" items="[[getIconNames(item)]]">
<template is="dom-repeat" >
<div class="icon-container">
<iron-icon icon="[[item]]"></iron-icon>
<span>[[item]]</span>
</div>
</template>
</dom-repeat>
<h3>Simple Usage</h3>
<vaadin-demo-snippet id='icons-basic-demos-simple-usage'>
<template preserve-content>
<iron-icon icon="vaadin:vaadin-h"></iron-icon>
</template>
</dom-repeat>
</vaadin-demo-snippet>

<h3>All Icons</h3>
<vaadin-text-field value="{{search}}" label="Filter" placeholder="Icon Name"></vaadin-text-field>
<div class="iconset-container">
<dom-repeat items="[[iconsets]]">
<template>
<dom-repeat id="wrapper" items="[[getIconNames(item, search)]]">
<template is="dom-repeat" >
<div class="icon-container">
<iron-icon icon="[[item]]"></iron-icon>
<span>[[item]]</span>
</div>
</template>
</dom-repeat>
</template>
</dom-repeat>
</div>
</template>
<script>
class IconsBasicDemos extends DemoReadyEventEmitter(IconsDemo(Polymer.Element)) {
Expand All @@ -76,10 +92,11 @@
window.webComponentsAreReady = true;
}

getIconNames(iconset) {
return iconset.getIconNames();
getIconNames(iconset, search) {
return iconset.getIconNames().filter(name => RegExp('^vaadin:' + search, 'i').test(name));
}
}

customElements.define(IconsBasicDemos.is, IconsBasicDemos);
</script>
</dom-module>
1 change: 0 additions & 1 deletion demo/icons-demo.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script>
/* @polymerMixin */
/* @polymerMixin */
IconsDemo = superClass => {
return class extends superClass {
Expand Down
1 change: 1 addition & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<link rel="import" href="../../vaadin-demo-helpers/vaadin-component-demo.html">
<link rel="import" href="../../vaadin-demo-helpers/vaadin-demo-snippet.html">
<link rel="import" href="../../vaadin-demo-helpers/vaadin-demo-ready-event-emitter.html">
<link rel="import" href="../../vaadin-text-field/vaadin-text-field.html">

<link rel="import" href="icons-demo.html">

Expand Down

0 comments on commit b21fdcf

Please sign in to comment.