|
12 | 12 | <link href="../../../../polymer-ui-elements/polymer-ui-menu-item/polymer-ui-menu-item.html" rel="import">
|
13 | 13 | <link href="../../../../polymer-ui-elements/polymer-ui-overlay/polymer-ui-overlay.html" rel="import">
|
14 | 14 | <link href="../../../../polymer-ui-elements/polymer-ui-toolbar/polymer-ui-toolbar.html" rel="import">
|
15 |
| -<link href="../../../list/elements/polymer-list/polymer-list.html" rel="import"> |
| 15 | +<link href="../../../list/elements/polymer-sectioned-list/polymer-sectioned-list.html" rel="import"> |
16 | 16 | <link href="contacts-create.html" rel="import">
|
17 | 17 | <link href="contacts-detail.html" rel="import">
|
18 | 18 | <link href="contacts-icon.html" rel="import">
|
|
70 | 70 | min-width: 320px;
|
71 | 71 | max-width: 384px;
|
72 | 72 | }
|
73 |
| - polymer-list { |
| 73 | + polymer-sectioned-list { |
74 | 74 | height: 100%;
|
75 | 75 | }
|
76 |
| - [tabletLayout] polymer-list { |
| 76 | + [tabletLayout] polymer-sectioned-list { |
77 | 77 | margin: 24px;
|
78 | 78 | }
|
79 | 79 | .contactItem {
|
80 | 80 | position: relative;
|
| 81 | + } |
| 82 | + polymer-sectioned-list ^ #sticky, |
| 83 | + .contactItem { |
81 | 84 | font-size: 14px;
|
82 | 85 | font-family: 'Helvetica Neue', HelveticaNeue, Helvetica, sans-serif;
|
83 | 86 | user-select: none;
|
84 | 87 | }
|
85 |
| - .contactItem.sticky { |
86 |
| - position: absolute; |
87 |
| - top: 0; |
88 |
| - left: 0; |
89 |
| - right: 0; |
90 |
| - z-index: 10; |
91 |
| - opacity: 0.95; |
92 |
| - } |
93 |
| - [tabletLayout] .contactItem.sticky { |
| 88 | + [tabletLayout] polymer-sectioned-list ^ #sticky { |
94 | 89 | display: none;
|
95 | 90 | }
|
| 91 | + polymer-sectioned-list ^ #sticky, |
96 | 92 | .contactItem.header {
|
97 | 93 | background: white;
|
98 | 94 | border-style: solid;
|
|
229 | 225 | </template>
|
230 | 226 | </polymer-ui-toolbar>
|
231 | 227 | <div id="listContainer" desktopLayout?="{{desktopLayout}}" tabletLayout?="{{tabletLayout}}">
|
232 |
| - <div id="sticky" class="contactItem header sticky"> |
233 |
| - {{stickyContent}} |
234 |
| - </div> |
235 |
| - <polymer-list id="list" data="{{$.mock.withHeaders}}" listData="{{listData}}" on-polymer-list-scroll="{{scrollAction}}"> |
| 228 | + <polymer-sectioned-list id="list" data="{{$.mock.withHeaders}}" listData="{{listData}}"> |
236 | 229 | <template repeat="{{contact in listData}}">
|
237 | 230 | <!-- <contacts-list-item contact="{{contact}}"></contacts-list-item> -->
|
238 | 231 |
|
|
257 | 250 | </template>
|
258 | 251 |
|
259 | 252 | </template>
|
260 |
| - </polymer-list> |
| 253 | + </polymer-sectioned-list> |
261 | 254 | </div>
|
262 | 255 | <contacts-detail id="details" contact="{{selectedContact.contact}}" desktopLayout?="{{desktopLayout}}" on-contacts-detail-cancel="{{closeDetailsAction}}"></contacts-detail>
|
263 | 256 | <polymer-ui-overlay id="createOverlay" xdesktopLayout?="{{desktopLayout}}" autocloseDisabled backdrop on-polymer-overlay-open="{{openCreateAction}}">
|
|
298 | 291 | Polymer('contacts-app', {
|
299 | 292 | desktopLayout: false,
|
300 | 293 | tabletLayout: false,
|
301 |
| - stickyContent: 'A', |
302 | 294 | selectedContact: null,
|
303 | 295 | observe: {
|
304 | 296 | desktopLayout: 'layoutChanged',
|
|
340 | 332 | layoutAction: function() {
|
341 | 333 | this.$.list.refresh();
|
342 | 334 | },
|
343 |
| - scrollAction: function() { |
344 |
| - var items = this.$.list.querySelectorAll('.contactItem'); |
345 |
| - var scrollTop = this.$.list.scrollOffset; |
346 |
| - var lastHeader; |
347 |
| - for (var i = 0, item; item = items[i]; i++) { |
348 |
| - var offset = item.offsetTop + (item.offsetParent ? item.offsetParent.offsetTop : 0); |
349 |
| - var isHeader = item.classList.contains('header'); |
350 |
| - if (lastHeader && offset > scrollTop) { |
351 |
| - this.stickyContent = lastHeader.textContent; |
352 |
| - var transY = offset - scrollTop - lastHeader.offsetHeight; |
353 |
| - if (transY < 0 && isHeader) { |
354 |
| - this.$.sticky.style['-webkit-transform'] = 'translateY(' + transY + 'px)'; |
355 |
| - } else { |
356 |
| - this.$.sticky.style['-webkit-transform'] = null; |
357 |
| - } |
358 |
| - break; |
359 |
| - } |
360 |
| - if (isHeader) { |
361 |
| - lastHeader = item; |
362 |
| - } |
363 |
| - } |
364 |
| - }, |
365 | 335 | pointerdownAction: function(e, detail, sender) {
|
366 | 336 | this.$.scrub.target = sender;
|
367 | 337 | this.$.translateAnimation.target = sender;
|
|
0 commit comments