From 0629a387b371b48520124750e7a402fef95f2bc3 Mon Sep 17 00:00:00 2001 From: romancm Date: Thu, 6 Jun 2019 06:44:06 -0700 Subject: [PATCH] Masonry layout WIP --- src/components/GameCards/GameCardGrid.vue | 36 +++++++++++++++++++ src/components/Lists/List.vue | 43 ++++++++++++++++++++++- src/i18n/en.js | 1 - 3 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 src/components/GameCards/GameCardGrid.vue diff --git a/src/components/GameCards/GameCardGrid.vue b/src/components/GameCards/GameCardGrid.vue new file mode 100644 index 00000000..a6c74fa9 --- /dev/null +++ b/src/components/GameCards/GameCardGrid.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/src/components/Lists/List.vue b/src/components/Lists/List.vue index 4ce2bbf9..3ee4049f 100644 --- a/src/components/Lists/List.vue +++ b/src/components/Lists/List.vue @@ -34,8 +34,19 @@ @update="updateLists" /> +
+ +
+ import draggable from 'vuedraggable'; +import Masonry from 'masonry-layout'; import ListNameEdit from '@/components/Lists/ListNameEdit'; import ListSettings from '@/components/Lists/ListSettings'; import GameCardDefault from '@/components/GameCards/GameCardDefault'; import GameCardCover from '@/components/GameCards/GameCardCover'; import GameCardWide from '@/components/GameCards/GameCardWide'; import GameCardText from '@/components/GameCards/GameCardText'; +import GameCardGrid from '@/components/GameCards/GameCardGrid'; import GameSearch from '@/components/GameSearch/GameSearch'; import { mapState, mapGetters } from 'vuex'; import firebase from 'firebase/app'; @@ -88,6 +101,7 @@ export default { GameCardCover, GameCardWide, GameCardText, + GameCardGrid, GameSearch, ListNameEdit, ListSettings, @@ -115,6 +129,7 @@ export default { covers: 'GameCardCover', wide: 'GameCardWide', text: 'GameCardText', + grid: 'GameCardGrid', }, }; }, @@ -175,7 +190,20 @@ export default { }, }, + mounted() { + if (this.view === 'grid') { + this.initGrid(); + } + }, + methods: { + initGrid() { + new Masonry('.game-grid', { + itemSelector: '.game-card', + gutter: 4, + }); + }, + updateLists(toastMessage) { this.$store.commit('CLEAR_ACTIVE_LIST_INDEX'); @@ -349,4 +377,17 @@ export default { .add-game-button { width: 100%; } + + .game-grid { + height: 100%; + display: flex; + align-items: center; + overflow: hidden; + max-height: calc(100vh - 154px); + min-height: 80px; + overflow-y: auto; + margin-top: $list-header-height; + padding: 4px; + width: 100%; + } diff --git a/src/i18n/en.js b/src/i18n/en.js index 95a33e79..d4feef40 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -5,7 +5,6 @@ module.exports = { cancel: 'Cancel', create: 'Create', filter: 'Filter', - with: 'with', by: 'by', no: 'no', yes: 'yes',