summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/catapult/third_party/polymer2/bower_components/paper-item/demo/index.html
blob: 3da7ec291f943a9e18b00e47db95e8296c1a9592 (plain)
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
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
<!doctype html>
<!--
@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
-->
<html>
<head>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">

  <title>paper-item demo</title>

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

  <link rel="import" href="../../iron-icon/iron-icon.html">
  <link rel="import" href="../../iron-icons/iron-icons.html">
  <link rel="import" href="../../iron-icons/communication-icons.html">
  <link rel="import" href="../../iron-demo-helpers/demo-snippet.html">
  <link rel="import" href="../../iron-demo-helpers/demo-pages-shared-styles.html">
  <link rel="import" href="../../paper-icon-button/paper-icon-button.html">
  <link rel="import" href="../paper-icon-item.html">
  <link rel="import" href="../paper-item.html">
  <link rel="import" href="../paper-item-body.html">
  <link rel="import" href="../../paper-styles/color.html">

  <custom-style>
    <style is="custom-style" include="demo-pages-shared-styles">
      div[role="listbox"] {
        border: 1px solid #e5e5e5;
      }
      .avatar {
        display: inline-block;
        box-sizing: border-box;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: var(--paper-amber-500);
      }

      .blue {
        background-color: var(--paper-light-blue-300);
      }
    </style>
  </custom-style>
</head>
<body unresolved>
  <div class="vertical-section-container centered">
    <h3>Paper-items are simple list elements, ideally used in a paper-listbox or
    an element with <i>role="listbox"</i></h3>
    <demo-snippet>
      <template>
        <div role="listbox">
          <paper-item>Inbox</paper-item>
          <paper-item>Starred</paper-item>
          <paper-item>Sent mail</paper-item>
        </div>
      </template>
    </demo-snippet>

    <h3>They can be styled using custom properties</h3>
    <demo-snippet>
      <template>
        <custom-style>
          <style is="custom-style">
            paper-item.fancy {
              --paper-item-focused: {
                background: var(--paper-amber-500);
                font-weight: bold;
              };
              --paper-item-focused-before: {
                opacity: 0;
              };
            }
          </style>
        </custom-style>
        <div role="listbox">
          <paper-item class="fancy">Inbox</paper-item>
          <paper-item class="fancy">Starred</paper-item>
          <paper-item class="fancy">Sent mail</paper-item>
        </div>
      </template>
    </demo-snippet>

    <h3>To add a leading element, use a paper-icon-item with a <code>slot="item-icon"</code>
    attribute in webcomponents v1. This leading image can be an iron-icon, or any other regular element.</h3>
    <demo-snippet>
      <template>
        <div role="listbox">
          <paper-icon-item>
            <iron-icon icon="inbox" slot="item-icon"></iron-icon>
            Inbox
          </paper-icon-item>
          <paper-icon-item>
            <iron-icon icon="star" slot="item-icon"></iron-icon>
            Starred
          </paper-icon-item>
          <paper-icon-item>
            <div class="avatar blue" slot="item-icon"></div>
            Alphonso Engelking
          </paper-icon-item>
          <paper-icon-item>
            <div class="avatar" slot="item-icon"></div>
            Angela Decker
          </paper-icon-item>
        </div>
      </template>
    </demo-snippet>

    <h3>For two-line items, use a paper-item-body inside a paper-item or paper-icon-item</h3>
    <demo-snippet>
      <template>
        <div role="listbox">
          <paper-item>
            <paper-item-body two-line>
              <div>Profile Photo</div>
              <div secondary>Change your Google+ profile photo</div>
            </paper-item-body>
          </paper-item>
          <paper-icon-item>
            <iron-icon icon="communication:phone" slot="item-icon">
            </iron-icon>
            <paper-item-body two-line>
              <div>(650) 555-1234</div>
              <div secondary>Mobile</div>
            </paper-item-body>
          </paper-icon-item>
          <paper-icon-item>
            <div class="avatar blue" slot="item-icon"></div>
            <paper-item-body two-line>
              <div>Alphonso Engelking</div>
              <div secondary>Change photo</div>
            </paper-item-body>
          </paper-icon-item>
        </div>
      </template>
    </demo-snippet>

    <h3>Complex layouts are usually a combination of all these elements</h3>
    <demo-snippet>
      <template>
        <div role="listbox">
          <paper-icon-item>
            <div class="avatar blue" slot="item-icon"></div>
            <paper-item-body two-line>
              <div>Photos</div>
              <div secondary>Jan 9, 2014</div>
            </paper-item-body>
            <paper-icon-button icon="star" alt="favourite this!">
            </paper-icon-button>
          </paper-icon-item>
          <paper-icon-item>
            <div class="avatar" slot="item-icon"></div>
            <paper-item-body two-line>
              <div>Recipes</div>
              <div secondary>Jan 17, 2014</div>
            </paper-item-body>
            <paper-icon-button icon="star" alt="favourite this!">
            </paper-icon-button>
          </paper-icon-item>
        </div>
      </template>
    </demo-snippet>

    <h3>Paper-items can be used as links</h3>
    <demo-snippet>
      <template>
        <custom-style>
          <style is="custom-style">
            .paper-item-link {
              color: inherit;
              text-decoration: none;
            }
          </style>
        </custom-style>
        <div role="listbox">
          <a class="paper-item-link" href="#inbox" tabindex="-1">
            <paper-item>Inbox</paper-item>
          </a>
          <a class="paper-item-link" href="#starred" tabindex="-1">
            <paper-item>Starred</paper-item>
          </a>
          <a class="paper-item-link" href="#sent" tabindex="-1">
            <paper-item>Sent mail</paper-item>
          </a>
        </div>
      </template>
    </demo-snippet>
  </div>
</body>
</html>