Skip to content

Commit d24b080

Browse files
committed
fix(range): fix styling on range, add demo
references #5422
1 parent f239b72 commit d24b080

File tree

6 files changed

+85
-6
lines changed

6 files changed

+85
-6
lines changed

demos/range/index.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {App} from 'ionic-angular';
2+
3+
@App({
4+
templateUrl: 'main.html'
5+
})
6+
class ApiDemoApp {
7+
brightness: number = 20;
8+
saturation: number = 0;
9+
warmth: number = 1300;
10+
structure: any = {lower: 33, upper: 60};
11+
12+
onChange(ev) {
13+
console.log("Changed", ev);
14+
}
15+
}

demos/range/main.html

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<ion-toolbar>
2+
<ion-title>Range</ion-title>
3+
</ion-toolbar>
4+
5+
<ion-content class="outer-content">
6+
<ion-list>
7+
<ion-list-header>
8+
Brightness
9+
<ion-badge item-right>{{brightness}}</ion-badge>
10+
</ion-list-header>
11+
<ion-item>
12+
<ion-icon item-left small name="sunny"></ion-icon>
13+
<ion-range [(ngModel)]="brightness"></ion-range>
14+
<ion-icon item-right name="sunny"></ion-icon>
15+
</ion-item>
16+
</ion-list>
17+
18+
<ion-list>
19+
<ion-list-header>
20+
Saturation
21+
<ion-badge item-right secondary>{{saturation}}</ion-badge>
22+
</ion-list-header>
23+
<ion-item>
24+
<ion-note item-left>-200</ion-note>
25+
<ion-range min="-200" max="200" pin="true" [(ngModel)]="saturation" secondary></ion-range>
26+
<ion-note item-right>200</ion-note>
27+
</ion-item>
28+
</ion-list>
29+
30+
<ion-list>
31+
<ion-list-header>
32+
Warmth
33+
<ion-badge item-right danger>{{warmth}}</ion-badge>
34+
</ion-list-header>
35+
<ion-item>
36+
<ion-icon item-left small danger name="thermometer"></ion-icon>
37+
<ion-range min="1000" max="2000" step="100" snaps="true" [(ngModel)]="warmth" danger></ion-range>
38+
<ion-icon item-right danger name="thermometer"></ion-icon>
39+
</ion-item>
40+
</ion-list>
41+
42+
<ion-list>
43+
<ion-list-header>
44+
Structure
45+
<ion-badge item-right dark>{{structure.lower}}</ion-badge>
46+
<ion-badge item-right dark>{{structure.upper}}</ion-badge>
47+
</ion-list-header>
48+
<ion-item>
49+
<ion-note item-left>0</ion-note>
50+
<ion-range dualKnobs="true" pin="true" [(ngModel)]="structure" (ionChange)="onChange($event)" dark></ion-range>
51+
<ion-note item-right>100</ion-note>
52+
</ion-item>
53+
</ion-list>
54+
</ion-content>

src/components/range/range.ios.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ ion-range {
4848
position: relative;
4949
display: block;
5050

51-
margin-top: -8px;
5251
padding: $range-ios-padding;
5352
}
5453

@@ -173,7 +172,8 @@ ion-range {
173172
@each $color-name, $color-base, $color-contrast in get-colors($colors-ios) {
174173

175174
ion-range[#{$color-name}] {
176-
.range-bar-active {
175+
.range-bar-active,
176+
.range-tick-active {
177177
background: $color-base;
178178
}
179179
}

src/components/range/range.md.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ ion-range {
4646
position: relative;
4747
display: block;
4848

49-
margin-top: -16px;
5049
padding: $range-md-padding;
5150
}
5251

src/components/range/range.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,19 @@ import {pointerCoord} from '../../util/dom';
1010
const RANGE_VALUE_ACCESSOR = new Provider(
1111
NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => Range), multi: true});
1212

13-
13+
/**
14+
* @name Range
15+
* @description
16+
* The Range slider lets users select from a range of values by moving
17+
* the slider knob.
18+
*
19+
*
20+
*
21+
*
22+
*
23+
*
24+
* @demo /docs/v2/demos/range/
25+
*/
1426
@Component({
1527
selector: '.range-knob-handle',
1628
template:
@@ -231,7 +243,7 @@ export class Range {
231243
/**
232244
* @output {Range} Expression to evaluate when the range value changes.
233245
*/
234-
@Output() rangeChange: EventEmitter<Range> = new EventEmitter();
246+
@Output() ionChange: EventEmitter<Range> = new EventEmitter();
235247

236248

237249
constructor(

src/components/range/range.wp.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ ion-range {
4747
position: relative;
4848
display: block;
4949

50-
margin-top: -16px;
5150
padding: $range-wp-padding;
5251
}
5352

0 commit comments

Comments
 (0)