gamebrary/src/components/GameBoard/GameBoardPlaceholder.vue

122 lines
2.5 KiB
Vue
Raw Normal View History

2019-01-11 20:20:21 +00:00
<template lang="html">
2019-11-08 20:34:06 +00:00
<div class="gameboard-placeholder">
<div
v-for="list in lists"
:class="`list ${list.view || 'single'}`"
:key="list.name"
>
2019-12-02 18:34:02 +00:00
<div class="list-header" />
2019-11-08 20:34:06 +00:00
2019-12-17 04:54:31 +00:00
<div :class="['games', list.view]">
2019-11-08 20:34:06 +00:00
<placeholder
2019-12-17 04:54:31 +00:00
class="game"
2019-11-08 20:34:06 +00:00
v-for="n in list.games.length"
:lines="list && list.view === 'grid' ? 0 : 2"
:key="n"
2019-12-17 04:54:31 +00:00
:image="list.view !== 'text'"
2019-11-08 20:34:06 +00:00
/>
</div>
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';
import Placeholder from '@/components/Placeholder';
2019-01-11 20:20:21 +00:00
export default {
2019-11-08 19:56:03 +00:00
components: {
Placeholder,
},
2019-01-11 20:20:21 +00:00
2019-11-08 19:56:03 +00:00
computed: {
...mapState(['gameLists', 'platform']),
2019-01-11 20:20:21 +00:00
2019-11-08 19:56:03 +00:00
lists() {
return this.gameLists && this.platform && this.gameLists[this.platform.code]
? this.gameLists[this.platform.code]
: [];
},
},
2019-01-11 20:20:21 +00:00
2019-11-08 19:56:03 +00:00
methods: {
randomColumn() {
return Math.floor(Math.random() * 4) + 1;
2019-01-11 20:20:21 +00:00
},
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
@import "~styles/styles";
.gameboard-placeholder {
user-select: none;
display: flex;
align-items: flex-start;
}
.list {
flex-shrink: 0;
cursor: default;
border-radius: $border-radius;
background: var(--list-background);
overflow: hidden;
position: relative;
width: $list-width;
margin-right: $gp;
max-height: calc(100vh - 81px);
}
.list-header {
background: var(--list-header-background);
height: $list-header-height;
position: absolute;
width: 100%;
}
.games {
margin-top: $list-header-height;
display: grid;
grid-gap: $gp / 2 ;
padding: $gp / 2;
2019-12-17 04:54:31 +00:00
&.single {
--placeholder-text-margin: #{$gp / 2} #{$gp / 2} 0 0;
border-radius: $border-radius;
}
&.masonry {
--placeholder-image-width: 100px;
padding-top: $gp / 2;
grid-template-columns: 1fr 1fr 1fr;
grid-gap: $gp / 4;
}
&.grid {
--placeholder-image-width: 140px;
--placeholder-image-height: 200px;
padding-top: $gp / 2;
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: $gp / 4;
}
&.compact {
2019-12-17 04:54:31 +00:00
--placeholder-image-width: 50px;
--placeholder-image-height: 80px;
--placeholder-text-margin: #{$gp / 2} #{$gp / 2} 0 0;
}
&.text {
--placeholder-text-margin: #{$gp / 2};
}
}
.game {
background: var(--game-card-background);
border-radius: $border-radius;
overflow: hidden;
2019-11-08 20:34:06 +00:00
}
2019-01-11 20:20:21 +00:00
</style>