2021-02-03 20:39:51 +00:00
|
|
|
<template lang="html">
|
2021-02-03 22:14:38 +00:00
|
|
|
<b-container>
|
|
|
|
<h2 class="my-2">Boards</h2>
|
|
|
|
|
2021-02-03 20:39:51 +00:00
|
|
|
<div class="boards">
|
|
|
|
<b-card
|
|
|
|
v-for="board in publicBoards"
|
|
|
|
:key="board.id"
|
|
|
|
no-body
|
2021-02-21 18:14:46 +00:00
|
|
|
:bg-variant="darkTheme ? 'dark' : null"
|
|
|
|
:text-variant="darkTheme ? 'white' : null"
|
2021-02-03 20:39:51 +00:00
|
|
|
class="overflow-hidden clickable"
|
|
|
|
@click="viewBoard(board.id)"
|
|
|
|
>
|
|
|
|
<mini-board
|
|
|
|
:board="board"
|
|
|
|
:background-image="getWallpaper(board)"
|
|
|
|
/>
|
2021-02-03 22:14:38 +00:00
|
|
|
|
|
|
|
<div class="px-2">
|
|
|
|
{{ board.name }} by {{ board.owner }}
|
|
|
|
</div>
|
2021-02-03 20:39:51 +00:00
|
|
|
</b-card>
|
|
|
|
</div>
|
2021-02-03 22:14:38 +00:00
|
|
|
</b-container>
|
2021-02-03 20:39:51 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { mapState, mapGetters } from 'vuex';
|
|
|
|
import MiniBoard from '@/components/Board/MiniBoard';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
MiniBoard,
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
...mapState(['publicBoards', 'wallpapers']),
|
2021-02-21 18:14:46 +00:00
|
|
|
...mapGetters(['darkTheme']),
|
2021-02-03 20:39:51 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
this.load();
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
load() {
|
|
|
|
this.$store.dispatch('LOAD_PUBIC_BOARDS');
|
|
|
|
},
|
|
|
|
|
|
|
|
getWallpaper({ wallpaper }) {
|
|
|
|
const boardWallpaper = this.wallpapers.find(({ fullPath }) => fullPath === wallpaper);
|
|
|
|
|
|
|
|
return this.wallpapers.length && boardWallpaper && boardWallpaper.url;
|
|
|
|
},
|
|
|
|
|
|
|
|
viewBoard(id) {
|
|
|
|
this.$router.push({ name: 'public-board', params: { id } });
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" rel="stylesheet/scss" scoped>
|
|
|
|
.boards {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: 1fr 1fr 1fr;
|
|
|
|
grid-gap: 1rem;
|
|
|
|
|
|
|
|
@media(max-width: 780px) {
|
|
|
|
grid-template-columns: 1fr 1fr;
|
|
|
|
}
|
|
|
|
|
|
|
|
@media(max-width: 480px) {
|
|
|
|
grid-template-columns: 1fr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|