Skip to content

Commit f2cf854

Browse files
committed
Added docs
1 parent 6192d57 commit f2cf854

File tree

1 file changed

+36
-13
lines changed

1 file changed

+36
-13
lines changed

paper-pager.html

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,23 @@
33
<link rel="import" href="../iron-selector/iron-selector.html">
44

55
<!--
6-
`paper-pager`
7-
A little Material Design page indicator
6+
`paper-pager` is a Material Design page indicator that adapts to provided variables
7+
and sets `selected` as user clicks on it. It doesn't require any variable but
8+
it's higly recommended to provide `itemsCount` (as number) or `items` (as array).
9+
10+
Example:
11+
12+
<paper-pager items-count="3" selected="{{selected}}></paper-pager>
13+
14+
### Styling
15+
16+
The following custom properties and mixins are available for styling:
17+
18+
Custom property | Description | Default
19+
----------------|-------------|----------
20+
`--paper-pager-color` | Color of dots | `white`
21+
`--paper-pager-opacity` | Opacity of not selected dots | `0.7`
22+
If you quickly need to switch to dark theme you can use `dark` attribute.
823
924
@demo demo/index.html
1025
-->
@@ -65,17 +80,26 @@
6580
is: 'paper-pager',
6681

6782
properties: {
68-
83+
/**
84+
* Number of items. If you set this leave items empty.
85+
*/
6986
itemsCount: {
7087
type: Number,
7188
value: 3,
7289
observer: '_computeItems'
7390
},
7491

92+
/**
93+
* Takes an array which length will be set as itemsCount. If you set this
94+
* leave itemsCount empty.
95+
*/
7596
items: {
7697
type: Array
7798
},
7899

100+
/**
101+
* Currently selected item's index.
102+
*/
79103
selected: {
80104
type: Number,
81105
notify: true,
@@ -84,6 +108,9 @@
84108
observer: '_selectedChanged'
85109
},
86110

111+
/**
112+
* Quickly switch to dark theme.
113+
*/
87114
dark: {
88115
type: Boolean,
89116
value: false,
@@ -92,8 +119,12 @@
92119

93120
},
94121

95-
listeners: {
96-
'dom-change': '_domRendered'
122+
attached: function() {
123+
if (this.selected == 0) {
124+
this._selectedChanged(this.selected, 2);
125+
} else {
126+
this._selectedChanged(this.selected, 0);
127+
}
97128
},
98129

99130
_onTap: function(e) {
@@ -104,14 +135,6 @@
104135
this.items = new Array(count);
105136
},
106137

107-
_domRendered: function() {
108-
if (this.selected == 0) {
109-
this._selectedChanged(this.selected, 2);
110-
} else {
111-
this._selectedChanged(this.selected, 0);
112-
}
113-
},
114-
115138
_selectedChanged: function(selected, lastSelected) {
116139
if(selected === undefined || lastSelected === undefined) return;
117140
var dot = this.$$('.dot').style;

0 commit comments

Comments
 (0)