forked from athiwatp/vue-radial-progress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
272 lines (255 loc) · 7.66 KB
/
index.html
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
<!DOCTYPE html>
<html lang="en">
<head>
<title>Vue.js Radial Progress Bar Demo</title>
<style>
html, body {
background: #4e4f4f;
text-align: center;
color: #FFF;
font-family: 'Open Sans', Helvetica, Verdana, sans-serif;
font-size: 16px;
}
#app {
display: flex;
align-items: center;
}
.radial-progress-display {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
}
.radial-progress-controls {
display: flex;
flex: 1;
}
.controls {
margin-top: 10px;
text-align: center;
}
.controls button {
border-radius: 5px;
color: #fff;
padding: 13px 20px;
background: #ff9f37;
border: 0;
outline: 0;
line-height: 1.3em;
text-transform: uppercase;
cursor: pointer;
box-sizing: border-box;
}
.controls button:hover {
background: #ff9f37;
}
p {
margin: 5px 0;
}
.visible-collapse {
visibility: collapse;
}
input {
margin: 0;
padding: 8px;
border: 1px solid #ccc;
border-radius: 5px;
}
input, button {
font: inherit;
margin-bottom: 10px;
}
.text-left {
text-align: left;
}
.text-right {
text-align: right;
}
label {
margin-right: 15px;
}
.spc-b {
margin-bottom: 30px;
}
</style>
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<script async defer src="https://buttons.github.io/buttons.js"></script>
</head>
<body>
<h1>Vue.js Radial Progress Bar</h1>
<p class="spc-b">Customizable radial progress bar component with gradients and animations!</p>
<div class="spc-b">
<a class="github-button"
href="https://github.com/wyzantinc/vue-radial-progress"
data-style="mega"
data-count-href="/wyzantinc/vue-radial-progress/stargazers"
data-count-api="/repos/wyzantinc/vue-radial-progress#stargazers_count"
data-count-aria-label="# stargazers on GitHub"
aria-label="Star wyzantinc/vue-radial-progress on GitHub">View on Github</a>
</div>
<div id="app">
<div class="radial-progress-display">
<radial-progress-bar :diameter="diameter"
:total-steps="totalSteps"
:completed-steps="completedSteps"
:animate-speed="animateSpeed"
:stroke-width="strokeWidth"
:start-color="startColor"
:stop-color="stopColor"
:inner-stroke-color="innerStrokeColor"
:timing-func="timingFunc">
<p>Total steps: {{ totalSteps }}</p>
<p>Completed steps: {{ completedSteps }}</p>
</radial-progress-bar>
<div class="controls">
<button :disabled="completedSteps <= 0"
@click.prevent="prevStep">Prev</button>
<button :disabled="completedSteps >= totalSteps"
@click.prevent="nextStep">Next</button>
</div>
</div>
<table class="radial-progress-controls text-right">
<tr>
<td>
<label for="total-steps">Total steps</label>
</td>
<td>
<input id="total-steps" type="number" placeholder="Total steps" :value="totalSteps" @input="totalStepsChanged">
</td>
</tr>
<tr>
<td>
<label for="animate-speed">Animate speed</label>
</td>
<td>
<input id="animate-speed" type="number" placeholder="Animate speed" :value="animateSpeed" @input="animateSpeedChanged">
</td>
</tr>
<tr>
<td>
<label for="diameter">Diameter</label>
</td>
<td>
<input id="diameter" type="number" placeholder="Diameter" :value="diameter" @input="diameterChanged">
</td>
</tr>
<tr>
<td>
<label for="stroke-width">Stoke width</label>
</td>
<td>
<input id="stroke-width" type="number" placeholder="Stroke width" :value="strokeWidth" @input="strokeWidthChanged">
</td>
</tr>
<tr>
<td>
<label for="timing-function">Timing function</label>
</td>
<td>
<input id="timing-function" type="text" placeholder="Timing function" :value="timingFunc" @input="timingFuncChanged">
</td>
</tr>
<tr>
<td>
<label for="start-color">Start color</label>
</td>
<td>
<input id="start-color" type="color" placeholder="Start color" :value="startColor" @input="startColorChanged">
</td>
</tr>
<tr>
<td>
<label for="stop-color">Stop color</label>
</td>
<td>
<input id="stop-color" type="color" placeholder="Stop color" :value="stopColor" @input="stopColorChanged">
</td>
</tr>
<tr>
<td>
<label for="inner-stroke-color">Inner stroke color</label>
</td>
<td>
<input id="inner-stroke-color" type="color" placeholder="Inner stroke color" :value="innerStrokeColor" @input="innerStrokeColorChanged">
</td>
</tr>
</table>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.js"></script>
<script src="./dist/vue-radial-progress.min.js"></script>
<script>
Vue.config.debug = true
new Vue({
el: '#app',
components: {
RadialProgressBar: RadialProgressBar,
},
data () {
return {
completedSteps: 1,
totalSteps: 6,
animateSpeed: 1000,
diameter: 300,
strokeWidth: 10,
startColor: '#bbff42',
stopColor: '#429321',
innerStrokeColor: '#323232',
timingFunc: 'linear'
}
},
methods: {
timingFuncChanged(e) {
this.timingFunc = e.target.value
},
innerStrokeColorChanged (e) {
this.innerStrokeColor = e.target.value
},
stopColorChanged (e) {
this.stopColor = e.target.value
},
startColorChanged (e) {
this.startColor = e.target.value
},
strokeWidthChanged (e) {
e.preventDefault()
const val = e.target.value
if (!val || isNaN(val)) {
return false
}
this.strokeWidth = parseInt(val)
},
diameterChanged (e) {
e.preventDefault()
const val = e.target.value
if (!val || isNaN(val)) {
return false
}
this.diameter = parseInt(val)
},
animateSpeedChanged (e) {
e.preventDefault()
const val = e.target.value
if (!val || isNaN(val)) {
return false
}
this.animateSpeed = parseInt(val)
},
totalStepsChanged (e) {
e.preventDefault()
const val = e.target.value
if (!val || isNaN(val)) {
return false
}
this.totalSteps = parseInt(val)
},
nextStep () {
this.completedSteps += 1
},
prevStep () {
this.completedSteps -= 1
}
}
})
</script>
</body>
</html>