From b7a7f7ff3c53dfa5af653cd48d3dc2fb57a5e868 Mon Sep 17 00:00:00 2001 From: cagataycivici Date: Tue, 5 Feb 2019 06:40:53 +0300 Subject: [PATCH] Implemented Sidebar Component --- src/AppMenu.vue | 1 + src/assets/styles/primevue.css | 1 + src/components/dialog/Dialog.css | 1 - src/components/dialog/Dialog.vue | 4 - src/components/sidebar/Sidebar.css | 117 +++++++++++++++++++++++++++ src/components/sidebar/Sidebar.vue | 122 +++++++++++++++++++++++++++++ src/main.js | 2 + src/router.js | 5 ++ src/views/sidebar/SidebarDemo.vue | 62 +++++++++++++++ 9 files changed, 310 insertions(+), 5 deletions(-) create mode 100644 src/components/sidebar/Sidebar.css create mode 100644 src/components/sidebar/Sidebar.vue create mode 100644 src/views/sidebar/SidebarDemo.vue diff --git a/src/AppMenu.vue b/src/AppMenu.vue index 6095d8b39..61fa16d0f 100644 --- a/src/AppMenu.vue +++ b/src/AppMenu.vue @@ -78,6 +78,7 @@
● Dialog ● OverlayPanel + ● Sidebar
diff --git a/src/assets/styles/primevue.css b/src/assets/styles/primevue.css index 65c64f429..8a176552c 100644 --- a/src/assets/styles/primevue.css +++ b/src/assets/styles/primevue.css @@ -18,6 +18,7 @@ @import '../../components/progressbar/ProgressBar.css'; @import '../../components/radiobutton/RadioButton.css'; @import '../../components/rating/Rating.css'; +@import '../../components/sidebar/Sidebar.css'; @import '../../components/slider/Slider.css'; @import '../../components/spinner/Spinner.css'; @import '../../components/tabview/TabView.css'; diff --git a/src/components/dialog/Dialog.css b/src/components/dialog/Dialog.css index 5d8107755..940aad603 100644 --- a/src/components/dialog/Dialog.css +++ b/src/components/dialog/Dialog.css @@ -114,7 +114,6 @@ .p-dialog-enter-active, .p-dialog-leave-active { - transition: all 400ms cubic-bezier(0.25, 0.8, 0.25, 1); } diff --git a/src/components/dialog/Dialog.vue b/src/components/dialog/Dialog.vue index 420a0dcc4..0a6f6b3c4 100644 --- a/src/components/dialog/Dialog.vue +++ b/src/components/dialog/Dialog.vue @@ -104,7 +104,3 @@ export default { } } - - diff --git a/src/components/sidebar/Sidebar.css b/src/components/sidebar/Sidebar.css new file mode 100644 index 000000000..b51dbf89b --- /dev/null +++ b/src/components/sidebar/Sidebar.css @@ -0,0 +1,117 @@ +.p-sidebar { + position: fixed; + padding: .5em 1em; + -webkit-transition: transform .3s; + transition: transform .3s; +} + +.p-sidebar-left { + top: 0; + left: 0; + width: 20em; + height: 100%; +} + +.p-sidebar-right { + top: 0; + right: 0; + width: 20em; + height: 100%; +} + +.p-sidebar-top { + top: 0; + left: 0; + width: 100%; + height: 10em; +} + +.p-sidebar-bottom { + bottom: 0; + left: 0; + width: 100%; + height: 10em; +} + +.p-sidebar-full { + width: 100%; + height: 100%; + top: 0; + left: 0; + -webkit-transition: none; + transition: none; +} + +.p-sidebar-left.p-sidebar-enter, +.p-sidebar-left.p-sidebar-leave-to { + transform: translateX(-100%); +} + +.p-sidebar-right.p-sidebar-enter, +.p-sidebar-right.p-sidebar-leave-to { + transform: translateX(100%); +} + +.p-sidebar-top.p-sidebar-enter, +.p-sidebar-top.p-sidebar-leave-to { + transform: translateY(-100%); +} + +.p-sidebar-bottom.p-sidebar-enter, +.p-sidebar-bottom.p-sidebar-leave-to { + transform: translateY(100%); +} + +.p-sidebar-full.p-sidebar-enter, +.p-sidebar-full.p-sidebar-leave-to { + opacity: 0; +} + +.p-sidebar-full.p-sidebar-enter-active, +.p-sidebar-full.p-sidebar-leave-active { + transition: opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1); +} + +.p-sidebar-left.p-sidebar-sm, +.p-sidebar-right.p-sidebar-sm { + width: 20em; +} + +.p-sidebar-left.p-sidebar-md, +.p-sidebar-right.p-sidebar-md { + width: 40em; +} + +.p-sidebar-left.p-sidebar-lg, +.p-sidebar-right.p-sidebar-lg { + width: 60em; +} + +.p-sidebar-top.p-sidebar-sm, +.p-sidebar-bottom.p-sidebar-sm { + height: 10em; +} + +.p-sidebar-top.p-sidebar-md, +.p-sidebar-bottom.p-sidebar-md { + height: 20em; +} + +.p-sidebar-top.p-sidebar-lg, +.p-sidebar-bottom.p-sidebar-lg { + height: 30em; +} + +.p-sidebar-close { + float: right; + cursor: pointer; +} + +@media screen and (max-width: 64em) { + .p-sidebar-left.p-sidebar-lg, + .p-sidebar-left.p-sidebar-md, + .p-sidebar-right.p-sidebar-lg, + .p-sidebar-right.p-sidebar-md { + width: 20em; + } +} \ No newline at end of file diff --git a/src/components/sidebar/Sidebar.vue b/src/components/sidebar/Sidebar.vue new file mode 100644 index 000000000..8d5fd6d90 --- /dev/null +++ b/src/components/sidebar/Sidebar.vue @@ -0,0 +1,122 @@ + + + diff --git a/src/main.js b/src/main.js index ee0ea975e..d511948e2 100644 --- a/src/main.js +++ b/src/main.js @@ -26,6 +26,7 @@ import Rating from './components/rating/Rating'; import RadioButton from './components/radiobutton/RadioButton'; import SelectButton from './components/selectbutton/SelectButton'; import Slider from './components/slider/Slider'; +import Sidebar from './components/sidebar/Sidebar'; import Spinner from './components/spinner/Spinner'; import Textarea from './components/textarea/Textarea'; import Toolbar from './components/toolbar/Toolbar'; @@ -65,6 +66,7 @@ Vue.component('RadioButton', RadioButton); Vue.component('Rating', Rating); Vue.component('SelectButton', SelectButton); Vue.component('Slider', Slider); +Vue.component('Sidebar', Sidebar); Vue.component('Spinner', Spinner); Vue.component('TabView', TabView); Vue.component('TabPanel', TabPanel); diff --git a/src/router.js b/src/router.js index 20650e234..c0257b330 100644 --- a/src/router.js +++ b/src/router.js @@ -171,6 +171,11 @@ export default new Router({ name: 'selectbutton', component: () => import('./views/selectbutton/SelectButtonDemo.vue') }, + { + path: '/sidebar', + name: 'sidebar', + component: () => import('./views/sidebar/SidebarDemo.vue') + }, { path: '/slider', name: 'slider', diff --git a/src/views/sidebar/SidebarDemo.vue b/src/views/sidebar/SidebarDemo.vue new file mode 100644 index 000000000..73edfaa9c --- /dev/null +++ b/src/views/sidebar/SidebarDemo.vue @@ -0,0 +1,62 @@ + + +