gamebrary/src/components/GameBoard/GameBoardPlaceholder.vue

114 lines
2.5 KiB
Vue
Raw Normal View History

2019-10-09 16:30:07 +00:00
<!-- TODO: Account for unique list style (100%) -->
2019-01-11 20:20:21 +00:00
<template lang="html">
2019-10-09 16:30:07 +00:00
<div class="gameboard-placeholder">
2019-05-08 22:32:52 +00:00
<div
:class="`list ${list.view || 'single'}`"
v-for="list in lists"
:key="list.name"
>
2019-09-11 21:02:59 +00:00
<div class="list-header" :style="style" />
2019-01-11 20:20:21 +00:00
<div class="games">
<placeholder
image
v-for="n in list.games.length"
2019-06-07 16:05:18 +00:00
:lines="list && list.view === 'grid' ? 0 : 2"
:key="n"
/>
2019-01-11 20:20:21 +00:00
</div>
</div>
</div>
</template>
<script>
2019-01-17 06:21:41 +00:00
import { mapState, mapGetters } 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']),
...mapGetters(['brandingEnabled']),
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-09-11 21:02:59 +00:00
2019-11-08 19:56:03 +00:00
style() {
return this.brandingEnabled
? `background-color: ${this.platform.hex}; opacity: 0.8;`
: null;
2019-01-11 20:20:21 +00:00
},
2019-11-08 19:56:03 +00:00
},
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-09-10 20:02:16 +00:00
@import "~styles/styles";
2019-01-11 20:20:21 +00:00
.gameboard-placeholder {
user-select: none;
display: flex;
align-items: flex-start;
}
.list {
flex-shrink: 0;
cursor: default;
border-radius: $border-radius;
2019-10-09 16:30:07 +00:00
background: var(--list-background);
2019-01-11 20:20:21 +00:00
overflow: hidden;
position: relative;
width: $list-width;
margin-right: $gp;
max-height: calc(100vh - 81px);
&.wide {
--placeholder-image-width: 80px;
--placeholder-image-height: 80px;
}
2019-06-07 16:05:18 +00:00
&.grid {
--placeholder-image-width: 90px;
}
2019-06-07 16:05:18 +00:00
&.grid .games {
padding-top: $gp / 2;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-gap: $gp / 4;
.placeholder {
margin: 0;
padding: 0;
}
}
2019-01-17 06:21:41 +00:00
}
2019-01-11 20:20:21 +00:00
2019-01-17 06:21:41 +00:00
.list-header {
2019-10-09 16:30:07 +00:00
background: var(--list-header-background);
2019-01-17 06:21:41 +00:00
height: $list-header-height;
position: absolute;
width: 100%;
}
.games {
margin-top: $list-header-height;
display: grid;
grid-gap: $gp / 2 ;
2019-01-17 06:21:41 +00:00
width: 100%;
padding: $gp / 2;
}
2019-01-11 20:20:21 +00:00
</style>