Blame view

bower_components/iron-list/demo/external-content.html 6.6 KB
e619a3b0   Luigi Serra   Controllet cross ...
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
  <!--
  @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, paper-scroll-header-panel, filltext.com 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="../../paper-toolbar/paper-toolbar.html">
    <link rel="import" href="../../paper-scroll-header-panel/paper-scroll-header-panel.html">
    <link rel="import" href="../../paper-spinner/paper-spinner.html">
  
    <link rel="import" href="../../paper-icon-button/paper-icon-button.html">
    <link rel="import" href="../../iron-ajax/iron-ajax.html">
    <link rel="import" href="../../iron-icons/iron-icons.html">
  
    <link rel="import" href="../iron-list.html">
  
    <style is="custom-style">
      :root {
a1a3bc73   Luigi Serra   graphs updates
39
        --dark-primary-color: #F57C00;
e619a3b0   Luigi Serra   Controllet cross ...
40
41
42
43
44
45
46
47
48
49
      }
  
      paper-scroll-header-panel {
        @apply(--layout-fit);
        @apply(--layout-vertical);
        @apply(--paper-font-common-base);
      }
  
      paper-toolbar {
        background-color: var(--dark-primary-color);
a1a3bc73   Luigi Serra   graphs updates
50
51
52
53
54
55
56
        --paper-toolbar-title: {
          font-size: 40px;
          margin-left: 60px;
          -webkit-transform-origin: left center;
          transform-origin: left center;
          overflow: visible;
        };
e619a3b0   Luigi Serra   Controllet cross ...
57
58
59
60
      }
  
      .middle-container {
        height: 100%;
a1a3bc73   Luigi Serra   graphs updates
61
62
        @apply(--layout-center);
        @apply(--layout-horizontal);
e619a3b0   Luigi Serra   Controllet cross ...
63
64
65
        /*margin-left: 60px;*/
      }
  
a1a3bc73   Luigi Serra   graphs updates
66
67
68
69
70
      .bottom-container {
        @apply(--layout-center);
        @apply(--layout-horizontal);
      }
  
e619a3b0   Luigi Serra   Controllet cross ...
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
      .bottom {
        padding-left: 62px;
      }
  
      iron-list {
        background-color: var(--paper-grey-200, #eee);
        padding-bottom: 16px;
      }
  
      .item {
        @apply(--layout-horizontal);
  
        margin: 16px 16px 0 16px;
        padding: 20px;
  
        border-radius: 8px;
        background-color: white;
        border: 1px solid #ddd;
      }
  
      .pad {
        padding: 0 16px;
        @apply(--layout-flex);
        @apply(--layout-vertical);
      }
  
      .primary {
        font-size: 16px;
        font-weight: bold;
      }
  
      .secondary {
        font-size: 14px;
      }
  
      .dim {
        color: gray;
      }
  
a1a3bc73   Luigi Serra   graphs updates
110
111
112
113
      .spacer {
        @apply(--layout-flex);
      }
  
e619a3b0   Luigi Serra   Controllet cross ...
114
115
116
117
118
119
      /* Small */
      @media (max-width: 600px) {
        paper-toolbar.tall .title {
          font-size: 20px;
        }
      }
a1a3bc73   Luigi Serra   graphs updates
120
  
e619a3b0   Luigi Serra   Controllet cross ...
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
      .index {
        width: 30px;
      }
  
    </style>
  
  </head>
  <body unresolved>
  
    <template is="dom-bind" id="app">
      <iron-ajax id="get_filltext_ajax" auto
        url="//www.filltext.com/"
        params='{"rows": "1000", "fname":"{firstName}", "lname": "{lastName}", "address": "{streetAddress}",
         "city": "{city}", "state": "{usState|abb}", "zip": "{zip}", "integer": "{number|100}",
         "business": "{business}", "index": "{index}"}'
        handle-as="json"
        loading="{{loading}}"
        last-response="{{people}}">
      </iron-ajax>
a1a3bc73   Luigi Serra   graphs updates
140
      <paper-scroll-header-panel condenses keep-condensed-header>
e619a3b0   Luigi Serra   Controllet cross ...
141
142
        <paper-toolbar class="tall">
          <paper-icon-button icon="arrow-back"></paper-icon-button>
a1a3bc73   Luigi Serra   graphs updates
143
          <div class="spacer"></div>
e619a3b0   Luigi Serra   Controllet cross ...
144
145
146
147
          <paper-icon-button icon="search"></paper-icon-button>
          <paper-icon-button icon="refresh" on-tap="refreshData"></paper-icon-button>
          <paper-icon-button icon="more-vert"></paper-icon-button>
  
a1a3bc73   Luigi Serra   graphs updates
148
          <div class="middle middle-container">
eb240478   Luigi Serra   public room cards...
149
            <div class="title">iron-list &amp; filltext.com</div>
e619a3b0   Luigi Serra   Controllet cross ...
150
          </div>
a1a3bc73   Luigi Serra   graphs updates
151
          <div class="bottom bottom-container">
e619a3b0   Luigi Serra   Controllet cross ...
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
            <div class="bottom-title">
              <span class="length">Rows: <span>{{people.length}}</span></span>
              <paper-spinner active="{{loading}}"></paper-spinner>
            </div>
          </div>
        </paper-toolbar>
        <iron-list items="[[people]]" as="item">
          <template>
            <div>
              <div class="item">
                <div class="primary dim">[[item.index]]</div>
                <div class="pad">
                  <div class="primary"><span>[[item.fname]]</span> <span>[[item.lname]]</span></div>
                  <div class="secondary"><span>[[item.address]]</span> <span>[[item.city]]</span></div>
                  <div class="secondary"><span>[[item.city]]</span>, <span>[[item.state]]</span>  <span>[[item.zip]]</span></div>
                  <div class="secondary dim">[[item.business]]</div>
                </div>
                <iron-icon icon$="[[iconForItem(item)]]"></iron-icon>
              </div>
            </div>
          </template>
        </iron-list>
      </paper-scroll-header-panel>
    </template>
  
    <script>
  
      var app = document.querySelector('#app');
  
      document.querySelector('template[is=dom-bind]').iconForItem = function(item) {
        return item ? (item.integer < 50 ? 'star-border' : 'star') : '';
      };
  
      // Custom transformation: scale header's title
      addEventListener('paper-header-transform', function(e) {
        var title = document.querySelector('.title');
        var middleContainer = document.querySelector('.middle-container');
        var bottomContainer = document.querySelector('.bottom-container');
        var detail = e.detail;
        var heightDiff = detail.height - detail.condensedHeight;
        var yRatio = Math.min(1, detail.y / heightDiff);
        var maxMiddleScale = 0.50;  // title max size when condensed. The smaller the number the smaller the condensed size.
        var scaleMiddle = Math.max(maxMiddleScale, (heightDiff - detail.y) / (heightDiff / (1-maxMiddleScale))  + maxMiddleScale);
        var scaleBottom = 1 - yRatio;
  
        // Move/translate middleContainer
        Polymer.Base.transform('translate3d(0,' + yRatio * 100 + '%,0)', middleContainer);
  
        // Scale bottomContainer and bottom title to 0 and back
        Polymer.Base.transform('scale(' + scaleBottom + ') translateZ(0)', bottomContainer);
  
        // Scale middle Title
        Polymer.Base.transform('scale(' + scaleMiddle + ') translateZ(0)', title);
      });
  
      // Refresh Data
      app.refreshData = function() {
        this.$.get_filltext_ajax.generateRequest();
      };
  
    </script>
  </body>
  </html>