Blame view

bower_components/iron-list/demo/index.html 4.62 KB
73bcce88   luigser   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
  <!--

  @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 and paper-scroll-header-panel 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">

73bcce88   luigser   COMPONENTS
25
26
27
28
29
30
    <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-icon-button/paper-icon-button.html">

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

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

73bcce88   luigser   COMPONENTS
31
32
33
    <link rel="import" href="../iron-list.html">

  

    <style is="custom-style">

a1a3bc73   Luigi Serra   graphs updates
34
35
36
      body {

        @apply(--layout-fullbleed);

      }

73bcce88   luigser   COMPONENTS
37
38
39
40
41
  

      paper-scroll-header-panel {

        @apply(--layout-fit);

        @apply(--layout-vertical);

        @apply(--paper-font-common-base);

a1a3bc73   Luigi Serra   graphs updates
42
        background-color: var(--paper-grey-200, #eee);

73bcce88   luigser   COMPONENTS
43
44
45
46
47
      }

  

      paper-toolbar.tall .title {

        font-size: 40px;

        margin-left: 60px;

a1a3bc73   Luigi Serra   graphs updates
48
        overflow: visible;

73bcce88   luigser   COMPONENTS
49
50
51
  

        -webkit-transform-origin: left center;

        transform-origin: left center;

73bcce88   luigser   COMPONENTS
52
53
      }

  

e619a3b0   Luigi Serra   Controllet cross ...
54
55
56
57
      paper-toolbar paper-icon-button {

        --paper-icon-button-ink-color: white;

      }

  

73bcce88   luigser   COMPONENTS
58
      iron-list {

73bcce88   luigser   COMPONENTS
59
60
61
62
63
64
65
66
        padding-bottom: 16px;

      }

  

      .item {

        @apply(--layout-horizontal);

  

        margin: 16px 16px 0 16px;

        padding: 20px;

73bcce88   luigser   COMPONENTS
67
68
69
70
71
        border-radius: 8px;

        background-color: white;

        border: 1px solid #ddd;

      }

  

e619a3b0   Luigi Serra   Controllet cross ...
72
73
74
75
76
      .item:focus {

        outline: 0;

        border-color: #666;

      }

  

73bcce88   luigser   COMPONENTS
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
      .avatar {

        height: 40px;

        width: 40px;

        border-radius: 20px;

        box-sizing: border-box;

        background-color: #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
104
105
106
107
      .spacer {

        @apply(--layout-flex);

      }

  

73bcce88   luigser   COMPONENTS
108
109
110
111
112
113
114
115
    </style>

  

  </head>

  <body unresolved>

  

    <template is="dom-bind">

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

  

a1a3bc73   Luigi Serra   graphs updates
116
      <paper-scroll-header-panel condenses keep-condensed-header>

73bcce88   luigser   COMPONENTS
117
        <paper-toolbar class="tall">

e619a3b0   Luigi Serra   Controllet cross ...
118
          <paper-icon-button icon="arrow-back" alt="Back"></paper-icon-button>

a1a3bc73   Luigi Serra   graphs updates
119
          <div class="spacer"></div>

e619a3b0   Luigi Serra   Controllet cross ...
120
121
          <paper-icon-button icon="search" alt="Search"></paper-icon-button>

          <paper-icon-button icon="more-vert" alt="More options"></paper-icon-button>

73bcce88   luigser   COMPONENTS
122
123
124
125
126
          <div class="bottom title">iron-list</div>

        </paper-toolbar>

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

          <template>

            <div>

f748e9cf   Luigi Serra   new controllet an...
127
              <div class="item">

73bcce88   luigser   COMPONENTS
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
155
156
157
158
159
                <img class="avatar" src="[[item.image]]">

                <div class="pad">

                  <div class="primary">[[item.name]]</div>

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

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

                </div>

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

              </div>

            </div>

          </template>

        </iron-list>

      </paper-scroll-header-panel>

    </template>

  

    <script>

  

      document.querySelector('template[is=dom-bind]').iconForItem = function(item) {

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

      };

  

      document.addEventListener('paper-header-transform', function(event) {

        var title = this.querySelector('.title');

        var detail = event.detail;

        var deltaHeight = detail.height - detail.condensedHeight;

        var scale = Math.max(0.6, (deltaHeight - detail.y) / (deltaHeight / 0.4)  + 0.6);

  

        Polymer.Base.transform('scale(' + scale + ') translateZ(0)', title);

      });

  

    </script>

  </body>

  </html>