| 1 |
<template> |
| 2 |
<div class="progress" role="progressbar"> |
| 3 |
<div class="progress-bar" :class="{ 'progress-bar-striped': striped !== undefined }" role="progressbar" aria-valuemin="0" aria-valuemax="100" :aria-valuenow="value" :style="`width: ${value}%`"> |
| 4 |
<slot>{{ value }}%</slot> |
| 5 |
</div> |
| 6 |
</div> |
| 7 |
</template> |
| 8 |
|
| 9 |
<script> |
| 10 |
export default { |
| 11 |
name: "Progressbar", |
| 12 |
props: ['value', 'striped'] |
| 13 |
} |
| 14 |
</script> |
| 15 |
|
| 16 |
<style scoped> |
| 17 |
@-webkit-keyframes progress-bar-stripes { |
| 18 |
from { |
| 19 |
background-position: 1rem 0; |
| 20 |
} |
| 21 |
to { |
| 22 |
background-position: 0 0; |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
@keyframes progress-bar-stripes { |
| 27 |
from { |
| 28 |
background-position: 1rem 0; |
| 29 |
} |
| 30 |
to { |
| 31 |
background-position: 0 0; |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
.progress { |
| 36 |
display: -ms-flexbox; |
| 37 |
display: flex; |
| 38 |
height: 1rem; |
| 39 |
overflow: hidden; |
| 40 |
font-size: 0.75rem; |
| 41 |
background-color: #e9ecef; |
| 42 |
border-radius: 0.25rem; |
| 43 |
} |
| 44 |
|
| 45 |
.progress-bar { |
| 46 |
display: -ms-flexbox; |
| 47 |
display: flex; |
| 48 |
-ms-flex-direction: column; |
| 49 |
flex-direction: column; |
| 50 |
-ms-flex-pack: center; |
| 51 |
justify-content: center; |
| 52 |
color: #fff; |
| 53 |
text-align: center; |
| 54 |
white-space: nowrap; |
| 55 |
background-color: #007bff; |
| 56 |
transition: width 0.6s ease; |
| 57 |
} |
| 58 |
|
| 59 |
@media (prefers-reduced-motion: reduce) { |
| 60 |
.progress-bar { |
| 61 |
transition: none; |
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
.progress-bar-striped { |
| 66 |
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); |
| 67 |
background-size: 1rem 1rem; |
| 68 |
} |
| 69 |
|
| 70 |
.progress-bar-animated { |
| 71 |
-webkit-animation: progress-bar-stripes 1s linear infinite; |
| 72 |
animation: progress-bar-stripes 1s linear infinite; |
| 73 |
} |
| 74 |
|
| 75 |
@media (prefers-reduced-motion: reduce) { |
| 76 |
.progress-bar-animated { |
| 77 |
-webkit-animation: none; |
| 78 |
animation: none; |
| 79 |
} |
| 80 |
} |
| 81 |
</style> |
| 82 |
|