index.html 4.59 KB
<!--
@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 id="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=no">
  <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="../../app-layout/app-header/app-header.html">
  <link rel="import" href="../../app-layout/app-toolbar/app-toolbar.html">
  <link rel="import" href="../../app-layout/app-scroll-effects/app-scroll-effects.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-image/iron-image.html">
  <link rel="import" href="../iron-list.html">

  <style is="custom-style">
    body {
      @apply(--layout-fullbleed);
      font-family: 'Roboto', 'Noto', sans-serif;
      background-color: #eee;
    }

    app-header {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      z-index: 1;
      background-color: #0b8043;
      color: white;
      --app-header-background-front-layer: {
        background-color: #4285f4;
      };
    }

    app-header paper-icon-button {
      --paper-icon-button-ink-color: white;
    }

    [title] {
      font-weight: 400;
      margin: 0 0 0 50px;
    }

    [condensed-title] {
      font-weight: 400;
      margin-left: 30px;
    }

    [condensed-title] i {
      font-style: normal;
      font-weight: 100;
    }

    app-toolbar.tall {
      height: 148px;
    }

    iron-list {
      padding-top: 148px;
      margin-top: 64px;
      padding-bottom: 16px;
    }

    .item {
      @apply(--layout-horizontal);
      padding: 20px;
      border-radius: 8px;
      background-color: white;
      border: 1px solid #ddd;
      max-width: 800px;
      margin: 16px auto 0 auto;
    }

    .item:focus {
      outline: 0;
      border-color: #333;
    }

    .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;
    }

    .spacer {
      @apply(--layout-flex);
    }

  </style>

</head>
<body unresolved>

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

      <app-header condenses fixed effects="resize-title blend-background waterfall">
        <app-toolbar>
          <paper-icon-button icon="menu" drawer-toggle></paper-icon-button>
          <h4 condensed-title>iron-list <i>&mdash; Demo</i></h4>
          <paper-icon-button icon="search"></paper-icon-button>
          <paper-icon-button icon="more-vert"></paper-icon-button>
        </app-toolbar>
        <app-toolbar class="tall">
          <h1 title>iron-list</h1>
        </app-toolbar>
      </app-header>

      <!-- iron-list using the document scroll -->
      <iron-list items="[[data]]" as="item" scroll-target="html">
        <template>
          <div>
            <div class="item" tabindex$="[[tabIndex]]">
              <iron-image class="avatar" sizing="contain" src="[[item.image]]"></iron-image>
              <div class="pad">
                <div class="primary">[[item.name]] [[index]]</div>
                <div class="secondary">[[item.shortText]]</div>
                <div class="secondary dim">[[item.longText]]</div>
              </div>
            </div>
          </div>
        </template>
      </iron-list>

  </template>

</body>
</html>