1 | import angular from 'angular';
|
2 |
|
3 | import {storiesOf} from '@storybook/html';
|
4 |
|
5 | import angularDecorator, {APP_NAME} from '../../.storybook/angular-decorator';
|
6 |
|
7 | import RingProgressBar from './progress-bar-ng';
|
8 |
|
9 | const disableAnimations = window.location.search.includes('block-animations');
|
10 |
|
11 | storiesOf('Legacy Angular|Progress Bar Ng', module).
|
12 | addParameters({
|
13 | notes: 'Provides an Angular wrapper for Progress Bar.'
|
14 | }).
|
15 | addDecorator(angularDecorator()).
|
16 | add('basic', () => {
|
17 | angular.module(APP_NAME, [RingProgressBar]).
|
18 | controller('ExampleCtrl', function controller($interval) {
|
19 | this.value = disableAnimations ? 0.5 : 0;
|
20 |
|
21 | if (!disableAnimations) {
|
22 | $interval(() => {
|
23 | const currentValue = this.value;
|
24 | this.value = currentValue >= 1 ? 0 : currentValue + 0.1;
|
25 | }, 500);
|
26 | }
|
27 | });
|
28 | return `
|
29 | <div ng-controller="ExampleCtrl as ctrl">
|
30 | <div style="height: 25px; padding-top: 25px;">
|
31 | <rg-progress-bar value="ctrl.value"></rg-progress-bar>
|
32 | </div>
|
33 | <div style="height: 25px; background: #000; padding-top: 25px;">
|
34 | <rg-progress-bar value="ctrl.value" theme="'dark'"></rg-progress-bar>
|
35 | </div>
|
36 | <div style="height: 25px; background: #F0F0F0; padding-top: 25px;">
|
37 | <rg-progress-bar value="ctrl.value"></rg-progress-bar>
|
38 | </div>
|
39 | </div>
|
40 | `;
|
41 | });
|