diff --git a/pinry-spa/src/App.vue b/pinry-spa/src/App.vue index 4fdb41c..9a77569 100644 --- a/pinry-spa/src/App.vue +++ b/pinry-spa/src/App.vue @@ -16,7 +16,7 @@ export default { // Import Bulma and Buefy styles @import "~bulma"; @import "~buefy/src/scss/buefy"; - #app { + html { background-color: #F5F5EB; } .body { diff --git a/pinry-spa/src/components/Pins.vue b/pinry-spa/src/components/Pins.vue index 848584b..4ede89a 100644 --- a/pinry-spa/src/components/Pins.vue +++ b/pinry-spa/src/components/Pins.vue @@ -25,13 +25,18 @@
- pined by {{ item.author }} + pined by  + + + {{ item.author }} + + @@ -73,8 +78,20 @@ export default { data() { return { blocks: [], + offset: 0, }; }, + props: { + pinFilters: { + type: Object, + default() { + return { + tagFilter: null, + userFilter: null, + }; + }, + }, + }, methods: { buildBlocks(results) { const blocks = []; @@ -100,13 +117,24 @@ export default { }, ); }, + fetchMore() { + let promise; + if (this.pinFilters.tagFilter) { + promise = API.fetchPins(this.offset, this.pinFilters.tagFilter); + } else if (this.pinFilters.userFilter) { + promise = API.fetchPins(this.offset, null, this.pinFilters.userFilter); + } else { + promise = API.fetchPins(this.offset); + } + promise.then( + (resp) => { + this.blocks = this.buildBlocks(resp.data.results); + }, + ); + }, }, created() { - API.fetchPins(0).then( - (resp) => { - this.blocks = this.buildBlocks(resp.data.results); - }, - ); + this.fetchMore(); }, }; @@ -153,6 +181,9 @@ $avatar-height: 30px; width: $avatar-width; border-radius: 3px; } + .pin-tag { + margin-right: 0.2rem; + } } .pin-footer { position: relative; diff --git a/pinry-spa/src/router/index.js b/pinry-spa/src/router/index.js index 38e316e..07a6df2 100644 --- a/pinry-spa/src/router/index.js +++ b/pinry-spa/src/router/index.js @@ -1,6 +1,8 @@ import Vue from 'vue'; import VueRouter from 'vue-router'; import Home from '../views/Home.vue'; +import Pins4Tag from '../views/Pins4Tag.vue'; +import Pins4User from '../views/Pins4User.vue'; Vue.use(VueRouter); @@ -10,6 +12,16 @@ const routes = [ name: 'home', component: Home, }, + { + path: '/pins/tags/:tag', + name: 'tag', + component: Pins4Tag, + }, + { + path: '/pins/users/:user', + name: 'user', + component: Pins4User, + }, ]; const router = new VueRouter({ diff --git a/pinry-spa/src/views/Pins4Tag.vue b/pinry-spa/src/views/Pins4Tag.vue new file mode 100644 index 0000000..869d9c7 --- /dev/null +++ b/pinry-spa/src/views/Pins4Tag.vue @@ -0,0 +1,40 @@ + + + + + + diff --git a/pinry-spa/src/views/Pins4User.vue b/pinry-spa/src/views/Pins4User.vue new file mode 100644 index 0000000..8dfea52 --- /dev/null +++ b/pinry-spa/src/views/Pins4User.vue @@ -0,0 +1,40 @@ + + + + + +