Blame view

bower_components/iron-list/demo/demo1.html 3.69 KB
abeb4a17   Luigi Serra   Update components...
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
  <!--

  @license

  Copyright (c) 2015 The Polymer Project Authors. All rights reserved.

  This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt

  The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt

  The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt

  Code distributed by Google as part of the polymer project is also

  subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt

  -->

  

  <!doctype html>

  <html>

  <head>

  

    <title>iron-list demo</title>

  

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">

    <meta name="mobile-web-app-capable" content="yes">

    <meta name="apple-mobile-web-app-capable" content="yes">

  

    <script src="../../webcomponentsjs/webcomponents-lite.js"></script>

  

    <link rel="import" href="../../polymer/polymer.html">

    <link rel="import" href="../../iron-flex-layout/iron-flex-layout.html">

    <link rel="import" href="../iron-list.html">

  

    <link rel="import" href="../../iron-ajax/iron-ajax.html">

    <link rel="import" href="../../iron-icon/iron-icon.html">

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

    <link rel="import" href="../../paper-toolbar/paper-toolbar.html">

  

    <dom-module id="x-app">

  

      <style>

  

        :host {

          @apply(--layout-fit);

          @apply(--layout-vertical);

  

          display: block;

          font-family: sans-serif;

        }

  

        .toolbar {

          background: #E91E63;

          box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);

          color: white;

        }

  

        #list {

          @apply(--layout-flex);

        }

  

        .item {

          padding: 16px;

          @apply(--layout-horizontal);

        }

  

        .avatar {

          height: 40px;

          width: 40px;

          border-radius: 20px;

          box-sizing: border-box;

          border: 1px solid #DDD;

          background-color: #DDD;

        }

  

        .pad {

          padding: 0 16px;

          @apply(--layout-flex);

          @apply(--layout-vertical);

        }

  

        .primary {

          font-size: 16px;

        }

  

        .secondary {

          font-size: 14px;

        }

  

        .dim {

          color: gray;

        }

  

        .border {

          margin-left: 72px;

          border-bottom: 1px solid #DDD;

        }

  

        iron-icon {

          width: 24px;

          height: 24px;

        }

  

      </style>

  

      <template>

  

        <iron-ajax url="data/contacts.json" last-response="{{data}}" auto></iron-ajax>

  

        <paper-toolbar class="toolbar">

          <div>Inbox</div>

        </paper-toolbar>

  

        <iron-list id="list" items="[[data]]" as="item">

          <template>

            <div>

              <div class="item">

                <img class="avatar" src="[[item.image]]">

                <div class="pad">

                  <div class="primary">

                    <span>[[index]]</span>

                    <span>[[item.name]]</span>

                  </div>

                  <div class="secondary">[[item.shortText]]</div>

                  <div class="secondary dim">[[item.longText]]</div>

                </div>

                <iron-icon icon$="[[iconForItem(item)]]"></iron-icon>

              </div>

              <div class="border"></div>

            </div>

          </template>

        </iron-list>

  

      </template>

    </dom-module>

  

    <script>

  

      HTMLImports.whenReady(function() {

  

        Polymer({

  

          is: 'x-app',

  

          iconForItem: function(item) {

            return item ? (item.integer < 50 ? 'star-border' : 'star') : '';

          }

  

        });

  

     });

  

    </script>

  

  </head>

  <body unresolved>

  

    <x-app></x-app>

  

  </body>

  </html>