From 47d2a0df827ce780bf9b8ddb889eafdbf54dc14b Mon Sep 17 00:00:00 2001 From: cagataycivici Date: Wed, 26 Dec 2018 15:23:43 +0300 Subject: [PATCH] Implemented ProgressBar --- src/AppMenu.vue | 2 +- src/assets/styles/primevue.css | 1 + src/components/progressbar/ProgressBar.css | 109 +++++++++++++++++++++ src/components/progressbar/ProgressBar.vue | 48 +++++++++ src/main.js | 2 + src/router.js | 5 + src/views/progressbar/ProgressBarDemo.vue | 58 +++++++++++ 7 files changed, 224 insertions(+), 1 deletion(-) create mode 100644 src/components/progressbar/ProgressBar.css create mode 100644 src/components/progressbar/ProgressBar.vue create mode 100644 src/views/progressbar/ProgressBarDemo.vue diff --git a/src/AppMenu.vue b/src/AppMenu.vue index 6574fbb7c..f8b257a5e 100644 --- a/src/AppMenu.vue +++ b/src/AppMenu.vue @@ -137,7 +137,7 @@
- ● Link + ● ProgressBar
diff --git a/src/assets/styles/primevue.css b/src/assets/styles/primevue.css index 73a41b779..68ff9b398 100644 --- a/src/assets/styles/primevue.css +++ b/src/assets/styles/primevue.css @@ -9,6 +9,7 @@ @import '../../components/inputswitch/InputSwitch.css'; @import '../../components/listbox/Listbox.css'; @import '../../components/panel/Panel.css'; +@import '../../components/progressbar/ProgressBar.css'; @import '../../components/radiobutton/RadioButton.css'; @import '../../components/rating/Rating.css'; @import '../../components/slider/Slider.css'; diff --git a/src/components/progressbar/ProgressBar.css b/src/components/progressbar/ProgressBar.css new file mode 100644 index 000000000..d48f10a67 --- /dev/null +++ b/src/components/progressbar/ProgressBar.css @@ -0,0 +1,109 @@ +.p-progressbar { + height: 1.2em; + text-align: left; + position: relative; + overflow: hidden; +} + +.p-progressbar-determinate .p-progressbar-value { + height: 100%; + width: 0%; + position: absolute; + display: none; + border: 0 none; +} + +.p-progressbar-determinate .p-progressbar-value-animate { + -webkit-transition: width 1s ease-in-out; + -moz-transition: width 1s ease-in-out; + -o-transition: width 1s ease-in-out; + transition: width 1s ease-in-out; +} + +.p-progressbar-determinate .p-progressbar-label { + text-align: center; + height: 100%; + width: 100%; + position: absolute; + font-weight: bold; +} + +.p-progressbar-indeterminate { + height: .5em; +} + +.p-progressbar-indeterminate .p-progressbar-value { + border: 0 none; +} + +.p-progressbar-indeterminate .p-progressbar-value::before { + content: ''; + position: absolute; + background-color: inherit; + top: 0; + left: 0; + bottom: 0; + will-change: left, right; + -webkit-animation: p-progressbar-indeterminate-anim 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite; + animation: p-progressbar-indeterminate-anim 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite; +} + +.p-progressbar-indeterminate .p-progressbar-value::after { + content: ''; + position: absolute; + background-color: inherit; + top: 0; + left: 0; + bottom: 0; + will-change: left, right; + -webkit-animation: p-progressbar-indeterminate-anim-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite; + animation: p-progressbar-indeterminate-anim-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite; + -webkit-animation-delay: 1.15s; + animation-delay: 1.15s; +} + +@-webkit-keyframes p-progressbar-indeterminate-anim { + 0% { + left: -35%; + right: 100%; } + 60% { + left: 100%; + right: -90%; } + 100% { + left: 100%; + right: -90%; } +} +@keyframes p-progressbar-indeterminate-anim { + 0% { + left: -35%; + right: 100%; } + 60% { + left: 100%; + right: -90%; } + 100% { + left: 100%; + right: -90%; } +} + +@-webkit-keyframes p-progressbar-indeterminate-anim-short { + 0% { + left: -200%; + right: 100%; } + 60% { + left: 107%; + right: -8%; } + 100% { + left: 107%; + right: -8%; } +} +@keyframes p-progressbar-indeterminate-anim-short { + 0% { + left: -200%; + right: 100%; } + 60% { + left: 107%; + right: -8%; } + 100% { + left: 107%; + right: -8%; } +} \ No newline at end of file diff --git a/src/components/progressbar/ProgressBar.vue b/src/components/progressbar/ProgressBar.vue new file mode 100644 index 000000000..08c0d0d0d --- /dev/null +++ b/src/components/progressbar/ProgressBar.vue @@ -0,0 +1,48 @@ + + + diff --git a/src/main.js b/src/main.js index 657bd057c..c7f30a9d9 100644 --- a/src/main.js +++ b/src/main.js @@ -13,6 +13,7 @@ import InputText from './components/inputtext/InputText'; import Fieldset from './components/fieldset/Fieldset'; import Listbox from './components/listbox/Listbox'; import Panel from './components/panel/Panel'; +import ProgressBar from './components/progressbar/ProgressBar'; import Rating from './components/rating/Rating'; import RadioButton from './components/radiobutton/RadioButton'; import SelectButton from './components/selectbutton/SelectButton'; @@ -43,6 +44,7 @@ Vue.component('p-inputtext', InputText); Vue.component('p-listbox', Listbox); Vue.component('p-fieldset', Fieldset); Vue.component('p-panel', Panel); +Vue.component('p-progressBar', ProgressBar); Vue.component('p-radioButton', RadioButton); Vue.component('p-rating', Rating); Vue.component('p-selectButton', SelectButton); diff --git a/src/router.js b/src/router.js index 3df4c2111..b26f731a1 100644 --- a/src/router.js +++ b/src/router.js @@ -71,6 +71,11 @@ export default new Router({ name: 'panel', component: () => import('./views/panel/PanelDemo.vue') }, + { + path: '/progressbar', + name: 'progressbar', + component: () => import('./views/progressbar/ProgressBarDemo.vue') + }, { path: '/radiobutton', name: 'radiobutton', diff --git a/src/views/progressbar/ProgressBarDemo.vue b/src/views/progressbar/ProgressBarDemo.vue new file mode 100644 index 000000000..027306151 --- /dev/null +++ b/src/views/progressbar/ProgressBarDemo.vue @@ -0,0 +1,58 @@ + + + + +