gamebrary/src/components/GameCards/GameCardDefault.vue

193 lines
3.7 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"
2020-02-03 16:26:03 +00:00
class="drag-filter"
2019-11-21 21:52:24 +00:00
@click="openDetails"
/>
2019-11-08 20:34:06 +00:00
2020-02-03 16:26:03 +00:00
<i class="fas fa-grip-vertical draggable-icon game-drag-handle" />
2019-11-08 20:34:06 +00:00
<span
v-if="showReleaseDates && releaseDate"
v-text="releaseDateText"
class="release-date drag-filter"
>
</span>
<game-progress
v-if="gameProgress"
small
:progress="gameProgress"
2020-02-03 16:26:03 +00:00
class="drag-filter"
@click.native="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
2020-02-03 16:26:03 +00:00
class="drag-filter"
2019-11-08 20:34:06 +00:00
@click.native="openDetails"
/>
<i
v-if="note"
:title="note"
2020-02-03 16:26:03 +00:00
class="fas fa-sticky-note note drag-filter"
2019-11-08 20:34:06 +00:00
@click="openDetails"
/>
2020-02-03 16:26:03 +00:00
<div v-if="hasTags" class="game-tags drag-filter">
<div
v-for="({ games, hex, tagTextColor }, name) in tags"
2019-11-08 20:34:06 +00:00
v-if="games.includes(game.id)"
2020-02-03 16:26:03 +00:00
:key="name"
>
<tag
v-if="games.includes(game.id)"
:label="name"
:hex="hex"
:text-hex="tagTextColor"
readonly
@action="openTags"
/>
</div>
</div>
2019-11-08 20:34:06 +00:00
</div>
2019-11-21 21:52:24 +00:00
</div>
</template>
<script>
import GameRating from '@/components/GameDetail/GameRating';
import GameProgress from '@/components/GameDetail/GameProgress';
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,
GameProgress,
2019-11-08 19:56:03 +00:00
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: var(--border-radius);
2019-11-08 20:34:06 +00:00
overflow: hidden;
&.card-placeholder {
2020-02-03 16:26:03 +00:00
background: #e5e5e5;
outline: 1px dashed #a5a2a2;
2019-11-08 20:34:06 +00:00
opacity: 0.3;
2020-02-03 16:26:03 +00:00
img {
filter: grayscale(1);
}
2019-11-08 20:34:06 +00:00
.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;
2020-02-03 16:26:03 +00:00
align-items: flex-start;
2019-11-08 20:34:06 +00:00
.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;
}
2020-02-03 16:26:03 +00:00
.game-progress,
2019-11-08 20:34:06 +00:00
.game-rating, a {
display: inline-flex;
font-weight: bold;
}
.release-date {
color: var(--accent-color);
margin: $gp / 4 0;
}
2019-11-08 20:34:06 +00:00
&: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);
}
}
2020-02-03 16:26:03 +00:00
.draggable-icon {
2019-11-08 20:34:06 +00:00
@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