gamebrary/src/components/Board/BoardPlaceholder.vue

151 lines
3.1 KiB
Vue
Raw Normal View History

2019-01-11 20:20:21 +00:00
<template lang="html">
2020-10-05 18:42:04 +00:00
<div class="gameboard-placeholder" v-if="placeholderBoard && placeholderBoard.lists">
2019-11-08 20:34:06 +00:00
<div
v-for="list in placeholderBoard.lists"
2020-08-21 15:08:57 +00:00
:class="`list ${list.settings.view || 'single'}`"
2019-11-08 20:34:06 +00:00
:key="list.name"
>
2020-08-11 04:16:43 +00:00
<b-card no-body>
2020-09-30 23:08:11 +00:00
<b-card-header class="pt-2 pb-1 px-2">
<b-skeleton />
2020-08-11 04:16:43 +00:00
</b-card-header>
2019-11-08 20:34:06 +00:00
2020-09-30 23:08:11 +00:00
<div
v-if="list.games.length"
:class="['games', list.settings.view]"
>
<div v-for="n in list.games.length" :key="n">
<b-card
no-body
img-top
v-if="list.settings.view === 'grid'"
>
<b-skeleton-img
card-img="top"
height="180px"
/>
<b-card-body class="p-2">
<b-skeleton class="mt-2" />
</b-card-body>
</b-card>
<b-card
v-else-if="!list.settings.view || list.settings.view === 'single'"
no-body
img-left
>
<b-skeleton-img
card-img="left"
width="94px"
height="124px"
/>
<b-card-body class="p-2">
<b-skeleton />
</b-card-body>
</b-card>
<b-card
v-else-if="list.settings.view === 'compact'"
no-body
img-left
>
<b-skeleton-img
card-img="left"
width="70px"
height="93px"
/>
<b-card-body class="p-2">
<b-skeleton />
</b-card-body>
</b-card>
<b-card
v-else-if="list.settings.view === 'text'"
no-body
img-left
>
<b-card-body class="p-2">
<b-skeleton />
</b-card-body>
</b-card>
</div>
2019-11-08 20:34:06 +00:00
</div>
2020-08-26 21:23:15 +00:00
<b-button
v-else
variant="light"
block
class="mb-2"
disabled
>
Click here or drag games here
</b-button>
2020-08-11 04:16:43 +00:00
</b-card>
2019-01-11 20:20:21 +00:00
</div>
2019-11-08 20:34:06 +00:00
</div>
2019-01-11 20:20:21 +00:00
</template>
<script>
2019-11-26 21:29:15 +00:00
import { mapState } from 'vuex';
2019-01-11 20:20:21 +00:00
export default {
2020-08-25 04:24:02 +00:00
data() {
return {
placeholderBoard: {},
2020-08-25 04:24:02 +00:00
};
},
2019-11-08 19:56:03 +00:00
computed: {
...mapState(['boards', 'board']),
2020-08-25 04:24:02 +00:00
},
mounted() {
const boardId = this.$route.params.id;
this.placeholderBoard = Object.keys(this.board).length > 0
? this.board
: this.boards.find(({ id }) => id === boardId);
2019-11-08 19:56:03 +00:00
},
2019-01-11 20:20:21 +00:00
};
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
2019-11-08 20:34:06 +00:00
.gameboard-placeholder {
user-select: none;
display: flex;
align-items: flex-start;
}
.list {
flex-shrink: 0;
cursor: default;
border-radius: var(--border-radius);
2019-11-08 20:34:06 +00:00
background: var(--list-background);
overflow: hidden;
position: relative;
2020-07-22 20:44:48 +00:00
width: 300px;
margin-right: 1rem;
2019-11-08 20:34:06 +00:00
max-height: calc(100vh - 81px);
}
2020-08-26 21:23:15 +00:00
.header {
margin: 6px 0;
2019-11-08 20:34:06 +00:00
}
.games {
display: grid;
2020-09-30 23:08:11 +00:00
grid-gap: .5rem;
2020-07-22 20:44:48 +00:00
padding: .5rem;
2019-12-17 04:54:31 +00:00
&.grid {
2020-07-22 20:44:48 +00:00
padding-top: .5rem;
2019-12-17 04:54:31 +00:00
display: grid;
grid-template-columns: 1fr 1fr;
2020-07-22 20:44:48 +00:00
grid-gap: .25rem;
2019-12-17 04:54:31 +00:00
}
2019-11-08 20:34:06 +00:00
}
2019-01-11 20:20:21 +00:00
</style>