From 57812be1fd2398d582a3606c67ae90d556dce72a Mon Sep 17 00:00:00 2001 From: kurbezz Date: Mon, 14 Sep 2020 17:12:55 +0300 Subject: [PATCH] Add animations, add album page, add left panel autoclosing --- package.json | 4 ++- src/App.vue | 14 +++++++- src/components/Album.vue | 67 +++++++++++++++++++++++------------- src/components/LeftPanel.vue | 28 +++++++++++---- src/router/index.ts | 10 ++++-- src/views/Album.vue | 20 +++++++++++ src/views/Home.vue | 13 ++++--- 7 files changed, 118 insertions(+), 38 deletions(-) create mode 100644 src/views/Album.vue diff --git a/package.json b/package.json index 9fbda7b..46b1822 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,9 @@ "vue-class-component": "^7.2.3", "vue-property-decorator": "^8.4.2", "vue-router": "^3.2.0", - "vuescroll": "^4.16.1" + "vuescroll": "^4.16.1", + "vuex": "^3.5.1", + "vuex-smart-module": "^0.4.5" }, "devDependencies": { "@vue/cli-plugin-babel": "~4.5.0", diff --git a/src/App.vue b/src/App.vue index 3d4449f..0583651 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,7 +2,7 @@
- +
@@ -99,6 +99,18 @@ export default class App extends Vue { this.leftPanelClosed = !this.leftPanelClosed; } + + closeLeftPanel() { + if (this.leftPanelClosed) { + this.closeIcon.anim.setDirection(1); + this.closeIcon.anim.play(); + } else { + this.closeIcon.anim.setDirection(-1); + this.closeIcon.anim.play(); + } + + this.leftPanelClosed = true; + } } diff --git a/src/components/Album.vue b/src/components/Album.vue index 071d566..e9543e9 100644 --- a/src/components/Album.vue +++ b/src/components/Album.vue @@ -1,30 +1,34 @@ diff --git a/src/router/index.ts b/src/router/index.ts index 8e3e946..c134d6e 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,8 +1,9 @@ import Vue from 'vue' import VueRouter, { RouteConfig } from 'vue-router' -import Home from '@/views/Home.vue' -import About from '@/views/About.vue' +import Home from '@/views/Home.vue'; +import About from '@/views/About.vue'; +import Album from '@/views/Album.vue'; Vue.use(VueRouter) @@ -16,6 +17,11 @@ Vue.use(VueRouter) path: '/about', name: 'About Me', component: About + }, + { + path: '/album/:name', + name: 'Album Page', + component: Album, } ] diff --git a/src/views/Album.vue b/src/views/Album.vue new file mode 100644 index 0000000..c84561c --- /dev/null +++ b/src/views/Album.vue @@ -0,0 +1,20 @@ + + + + + diff --git a/src/views/Home.vue b/src/views/Home.vue index ea56e0e..012b32c 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -4,8 +4,6 @@
- -
@@ -29,7 +27,9 @@ import Album, { IAlbum } from '@/components/Album.vue'; export default class Home extends Vue { @Prop({required: true}) public readonly leftPanelClosed!: boolean; - public albums: IAlbum[] = [ + public albums: IAlbum[] = []; + + public sourceAlbums: IAlbum[] = [ { name: 'Test', description: 'Test description', @@ -74,6 +74,12 @@ export default class Home extends Vue { ] } ]; + + mounted() { + this.sourceAlbums.forEach((item, index) => { + setTimeout(() => this.albums.push(item), 300 * index); + }) + } } @@ -93,7 +99,6 @@ export default class Home extends Vue { .albums-wrapper { width: calc(100vw - 405px); margin-left: 405px; - } }