gamebrary/src/components/GameCards/GameCardDefault.vue

170 lines
3.1 KiB
Vue
Raw Normal View History

2019-11-26 21:37:10 +00:00
<!-- TODO: abstract styles, only add card specific styles in each component -->
<template lang="html">
2019-11-21 21:52:24 +00:00
<div v-if="gameId && games[gameId]" :class="gameCardClass">
2019-11-08 20:34:06 +00:00
<img
:src="coverUrl"
:alt="game.name"
2019-11-14 21:10:10 +00:00
@click="openDetails"
2019-11-21 21:52:24 +00:00
>
2019-11-08 20:34:06 +00:00
<div class="game-info">
<a
v-if="list.view !== 'covers'"
2019-11-14 21:10:10 +00:00
v-text="game.name"
2019-11-21 21:52:24 +00:00
@click="openDetails"
/>
2019-11-08 20:34:06 +00:00
<i class="fas fa-grip-vertical game-drag-handle" />
<progress
v-if="gameProgress"
max="100"
:value="gameProgress"
@click="openDetails"
/>
2019-11-08 20:34:06 +00:00
<game-rating
v-if="showGameRatings"
2019-11-08 20:34:06 +00:00
:rating="game.rating"
small
@click.native="openDetails"
/>
<i
v-if="note"
:title="note"
class="fas fa-sticky-note note"
@click="openDetails"
/>
2019-11-21 21:52:24 +00:00
<div v-if="hasTags" class="game-tags">
2019-11-08 20:34:06 +00:00
<div
2019-11-21 21:52:24 +00:00
v-for="({ games, hex, tagTextColor }, name) in tags"
v-if="games.includes(game.id)"
:key="name"
>
<tag
2019-11-08 20:34:06 +00:00
v-if="games.includes(game.id)"
2019-11-21 21:52:24 +00:00
:label="name"
:hex="hex"
:text-hex="tagTextColor"
readonly
@action="openTags"
/>
</div>
2019-11-08 20:34:06 +00:00
</div>
2019-11-21 21:52:24 +00:00
</div>
</div>
</template>
<script>
import GameRating from '@/components/GameDetail/GameRating';
import GameCardUtils from '@/components/GameCards/GameCard';
2019-11-21 22:06:14 +00:00
import Tag from '@/components/Tag';
export default {
2019-11-08 19:56:03 +00:00
components: {
GameRating,
Tag,
},
2019-11-08 19:56:03 +00:00
mixins: [GameCardUtils],
};
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
2019-11-08 20:34:06 +00:00
@import "~styles/styles";
$gameCoverWidth: 80px;
.game-card {
background: var(--game-card-background);
margin-bottom: $gp / 2;
position: relative;
display: grid;
grid-template-columns: $gameCoverWidth auto;
border-radius: $border-radius;
overflow: hidden;
&.card-placeholder {
background: var(--game-card-background);
opacity: 0.3;
.game-card-options {
display: none;
}
}
2019-11-08 20:34:06 +00:00
img {
width: $gameCoverWidth;
height: auto;
display: flex;
align-self: center;
cursor: pointer;
}
2019-11-08 20:34:06 +00:00
.game-info {
padding: $gp / 2 $gp;
width: 100%;
display: flex;
flex-direction: column;
.game-tags {
display: flex;
flex-wrap: wrap;
align-items: center;
margin-top: $gp / 4;
}
2019-11-26 21:34:53 +00:00
.tag {
margin-right: $gp / 4;
}
2019-11-08 20:34:06 +00:00
i.tags {
position: absolute;
bottom: $gp * 1.5;
right: $gp / 4;
}
.game-rating, a {
display: inline-flex;
font-weight: bold;
}
&:hover {
a {
text-decoration: underline;
}
2019-11-08 20:34:06 +00:00
}
2019-11-08 20:34:06 +00:00
a {
cursor: pointer;
margin-right: $gp / 2;
color: var(--game-card-text-color);
}
}
2019-11-08 20:34:06 +00:00
.game-drag-handle {
@include drag-cursor;
position: absolute;
color: #e5e5e5;
right: $gp / 3;
top: $gp / 3;
2019-11-08 20:34:06 +00:00
&:hover {
color: #a5a2a2;
}
}
2019-04-19 20:27:45 +00:00
2019-11-08 20:34:06 +00:00
.game-tag {
margin-bottom: $gp / 3;
2019-04-19 20:27:45 +00:00
}
2019-11-08 20:34:06 +00:00
}
.note {
color: var(--note-color);
}
</style>
2019-11-21 21:52:24 +00:00