From 47c106c4132f7ab0b36e41aa5be2ad99161a04a2 Mon Sep 17 00:00:00 2001 From: cagataycivici Date: Thu, 13 Dec 2018 23:39:16 +0300 Subject: [PATCH] Initiated accordion component --- src/AppMenu.vue | 1 + src/assets/styles/primevue.css | 1 + src/components/accordion/Accordion.css | 56 ++++++++++++++++++ src/components/accordion/Accordion.vue | 70 +++++++++++++++++++++++ src/components/accordion/AccordionTab.vue | 22 +++++++ src/main.js | 8 ++- src/router.js | 5 ++ src/views/accordion/AccordionDemo.vue | 51 +++++++++++++++++ 8 files changed, 212 insertions(+), 2 deletions(-) create mode 100644 src/components/accordion/Accordion.css create mode 100644 src/components/accordion/Accordion.vue create mode 100644 src/components/accordion/AccordionTab.vue create mode 100644 src/views/accordion/AccordionDemo.vue diff --git a/src/AppMenu.vue b/src/AppMenu.vue index 4d3fe946e..c3776eac7 100644 --- a/src/AppMenu.vue +++ b/src/AppMenu.vue @@ -43,6 +43,7 @@
+ ● Accordion ● Panel ● Fieldset ● FlexGrid diff --git a/src/assets/styles/primevue.css b/src/assets/styles/primevue.css index 029daab34..cda1cdfb8 100644 --- a/src/assets/styles/primevue.css +++ b/src/assets/styles/primevue.css @@ -1,4 +1,5 @@ @import '../../components/common/Common.css'; +@import '../../components/accordion/Accordion.css'; @import '../../components/inputtext/InputText.css'; @import '../../components/listbox/ListBox.css'; @import '../../components/button/Button.css'; diff --git a/src/components/accordion/Accordion.css b/src/components/accordion/Accordion.css new file mode 100644 index 000000000..abc74fdd7 --- /dev/null +++ b/src/components/accordion/Accordion.css @@ -0,0 +1,56 @@ +.p-accordion { + width: 100%; +} + +.p-accordion .p-accordion-header { + cursor: pointer; + position: relative; + margin-top: 1px; + zoom: 1; +} + +.p-accordion .p-accordion-header a { + display: block; + padding: .5em; +} + +.p-accordion .p-accordion-toggle-icon, +.p-accordion .p-accordion-header-text { + vertical-align: middle; +} + +.p-accordion .p-accordion-header a > span { + display: inline-block; + vertical-align: middle; +} + +.p-accordion .p-accordion-content { + padding: 1em; + border-top: 0; + zoom: 1; +} + +.p-accordion .p-accordion-header.p-disabled, +.p-accordion .p-accordion-header.p-disabled a { + cursor: default; +} + +.p-accordion-content-wrapper-enter, +.p-accordion-content-wrapper-leave-to { + max-height: 0; +} + +.p-accordion-content-wrapper-enter-to, +.p-accordion-content-wrapper-leave { + max-height: 1000px; +} + +.p-accordion-content-wrapper-leave-active { + overflow: hidden; + transition: max-height 0.45s cubic-bezier(0, 1, 0, 1); +} + +.p-accordion-content-wrapper-enter-active { + overflow: hidden; + transition: max-height 1s ease-in-out; +} \ No newline at end of file diff --git a/src/components/accordion/Accordion.vue b/src/components/accordion/Accordion.vue new file mode 100644 index 000000000..25b232aaa --- /dev/null +++ b/src/components/accordion/Accordion.vue @@ -0,0 +1,70 @@ + \ No newline at end of file diff --git a/src/components/accordion/AccordionTab.vue b/src/components/accordion/AccordionTab.vue new file mode 100644 index 000000000..affc7247b --- /dev/null +++ b/src/components/accordion/AccordionTab.vue @@ -0,0 +1,22 @@ + \ No newline at end of file diff --git a/src/main.js b/src/main.js index 9c5fd43ac..f5c510d98 100644 --- a/src/main.js +++ b/src/main.js @@ -1,6 +1,8 @@ import Vue from 'vue'; import App from './App.vue'; import router from './router'; +import Accordion from './components/accordion/Accordion'; +import AccordionTab from './components/accordion/AccordionTab'; import Button from './components/button/Button'; import InputText from './components/inputtext/InputText'; import Fieldset from './components/fieldset/Fieldset'; @@ -17,11 +19,13 @@ import 'primeicons/primeicons.css'; Vue.config.productionTip = false; -Vue.component('p-inputtext', InputText); +Vue.component('p-accordion', Accordion); +Vue.component('p-accordionTab', AccordionTab); Vue.component('p-button', Button); +Vue.component('p-inputtext', InputText); Vue.component('p-listBox', ListBox); -Vue.component('p-panel', Panel); Vue.component('p-fieldset', Fieldset); +Vue.component('p-panel', Panel); Vue.component('p-tabView', TabView); Vue.component('p-tabPanel', TabPanel); Vue.component('p-textarea', Textarea); diff --git a/src/router.js b/src/router.js index e8b835ec5..c094eca25 100644 --- a/src/router.js +++ b/src/router.js @@ -11,6 +11,11 @@ export default new Router({ name: 'home', component: Home }, + { + path: '/accordion', + name: 'accordion', + component: () => import('./views/accordion/AccordionDemo.vue') + }, { path: '/button', name: 'button', diff --git a/src/views/accordion/AccordionDemo.vue b/src/views/accordion/AccordionDemo.vue new file mode 100644 index 000000000..62528cb5b --- /dev/null +++ b/src/views/accordion/AccordionDemo.vue @@ -0,0 +1,51 @@ + \ No newline at end of file