gamebrary/src/components/GameCards/GameCardGrid.vue

269 lines
5.1 KiB
Vue
Raw Normal View History

2019-06-06 13:44:06 +00:00
<template lang="html">
<div v-if="gameId && games[gameId]" :class="gameCardClass">
2019-11-08 20:34:06 +00:00
<img
:src="coverUrl"
:alt="game.name"
@click="openDetails"
>
2019-12-15 04:32:40 +00:00
<game-progress
v-if="!showGameInfo && showGameInfoOnCover && gameProgress"
small
:progress="gameProgress"
@click.native="openDetails"
/>
<span
v-if="!showGameInfo && showGameInfoOnCover && showReleaseDates && releaseDate"
v-text="releaseDate"
class="release-date drag-filter"
>
</span>
<i class="fas fa-grip-vertical draggable-icon game-drag-handle" />
<div
v-if="showGameInfo"
class="game-info"
>
<a
v-text="game.name"
2020-02-03 16:26:03 +00:00
class="drag-filter"
@click="openDetails"
/>
<div class="rating-release">
<game-rating
v-if="showGameRatings"
:rating="game.rating"
small
class="drag-filter"
@click.native="openDetails"
/>
<span
v-if="showReleaseDates && releaseDate"
v-text="releaseDate"
class="release-date drag-filter"
>
</span>
</div>
<game-progress
v-if="gameProgress"
small
:progress="gameProgress"
2020-02-03 16:26:03 +00:00
class="drag-filter"
@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"
@click="openDetails"
/>
2020-02-03 16:26:03 +00:00
<i class="fas fa-grip-vertical draggable-icon game-drag-handle" />
2020-02-03 16:26:03 +00:00
<div v-if="hasTags" class="game-tags drag-filter">
<tag
v-for="({ games, hex, tagTextColor }, name) in tags"
v-if="games.includes(game.id)"
:key="name"
:label="name"
:hex="hex"
:text-hex="tagTextColor"
readonly
@action="openTags"
/>
</div>
2019-12-15 04:32:40 +00:00
</div>
2019-11-08 20:34:06 +00:00
</div>
2019-06-06 13:44:06 +00:00
</template>
<script>
2019-12-15 04:32:40 +00:00
import GameRating from '@/components/GameDetail/GameRating';
import GameProgress from '@/components/GameDetail/GameProgress';
2019-06-06 13:44:06 +00:00
import GameCardUtils from '@/components/GameCards/GameCard';
2019-12-15 04:32:40 +00:00
import Tag from '@/components/Tag';
2019-06-06 13:44:06 +00:00
export default {
2019-12-15 04:32:40 +00:00
components: {
GameRating,
GameProgress,
2019-12-15 04:32:40 +00:00
Tag,
},
2019-11-08 19:56:03 +00:00
mixins: [GameCardUtils],
2019-06-06 13:44:06 +00:00
};
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
2020-07-22 20:44:48 +00:00
// @import "~styles/styles";
2019-06-06 13:44:06 +00:00
2019-11-08 20:34:06 +00:00
.game-card {
display: flex;
flex-direction: column;
position: relative;
border-radius: var(--border-radius);
2019-11-08 20:34:06 +00:00
overflow: hidden;
cursor: pointer;
2019-06-06 13:44:06 +00:00
2019-12-15 04:32:40 +00:00
&.card-placeholder {
2020-02-03 16:26:03 +00:00
background: #e5e5e5;
outline: 1px dashed #a5a2a2;
2019-12-15 04:32:40 +00:00
opacity: 0.3;
2020-02-03 16:26:03 +00:00
img {
filter: grayscale(1);
}
2019-12-15 04:32:40 +00:00
.game-card-options {
display: none;
}
}
2019-11-08 20:34:06 +00:00
img {
width: 100%;
2019-12-15 04:32:40 +00:00
height: 185px;
object-fit: cover;
display: flex;
align-self: center;
cursor: pointer;
+ .game-progress {
2020-07-22 20:44:48 +00:00
width: calc(100% - 1rem);
position: absolute;
2020-07-22 20:44:48 +00:00
bottom: .3rem;
left: .5rem;
+ .release-date {
margin: 0;
position: absolute;
2020-07-22 20:44:48 +00:00
bottom: 1.5rem;
right: .5rem;
padding: .3rem .25rem;
background: var(--list-background);
}
}
+ .release-date {
margin: 0;
position: absolute;
2020-07-22 20:44:48 +00:00
bottom: .5rem;
right: .5rem;
padding: .3rem .25rem;
background: var(--list-background);
}
2019-12-15 04:32:40 +00:00
}
progress {
max-width: 100%;
}
.release-date {
color: var(--accent-color);
font-weight: bold;
justify-self: end;
2020-07-22 20:44:48 +00:00
margin: .25rem 0;
border-radius: var(--border-radius);
}
2019-12-15 04:32:40 +00:00
.game-info {
2020-07-22 20:44:48 +00:00
padding: .5rem;
2019-12-15 04:32:40 +00:00
width: 100%;
display: flex;
border-bottom-left-radius: var(--border-radius);
border-bottom-right-radius: var(--border-radius);
2019-12-15 04:32:40 +00:00
flex-direction: column;
background: var(--game-card-background);
2020-02-03 16:26:03 +00:00
align-items: flex-start;
2019-12-15 04:32:40 +00:00
.game-tags {
display: flex;
flex-wrap: wrap;
align-items: center;
2020-07-22 20:44:48 +00:00
margin-top: .25rem;
2019-12-15 04:32:40 +00:00
}
.tag {
2020-07-22 20:44:48 +00:00
margin-right: .25rem;
2019-12-15 04:32:40 +00:00
}
i.tags {
position: absolute;
2020-07-22 20:44:48 +00:00
bottom: 1.5rem;
right: .25rem;
2019-12-15 04:32:40 +00:00
}
.rating-release {
width: 100%;
display: grid;
grid-auto-flow: column;
}
2019-12-15 04:32:40 +00:00
.game-rating, a {
display: inline-flex;
font-weight: bold;
}
&:hover {
a {
text-decoration: underline;
}
}
a {
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
2020-07-22 20:44:48 +00:00
margin-right: .5rem;
2019-12-15 04:32:40 +00:00
color: var(--game-card-text-color);
}
.title-progress {
display: grid;
grid-template: auto auto / auto auto;
a {
grid-column: 1;
}
.game-rating {
grid-column: 1;
grid-row: 2;
}
.game-progress {
justify-self: end;
grid-column: 2;
grid-row: span 2;
}
}
2019-11-08 20:34:06 +00:00
}
2019-12-15 04:32:40 +00:00
2020-02-03 16:26:03 +00:00
.draggable-icon {
2020-07-22 20:44:48 +00:00
//@include drag-cursor;
2019-12-15 04:32:40 +00:00
position: absolute;
color: #e5e5e5;
2020-07-22 20:44:48 +00:00
right: .33rem;
top: .33rem;
2019-12-15 04:32:40 +00:00
&:hover {
color: #a5a2a2;
}
}
.game-tag {
2020-07-22 20:44:48 +00:00
margin-bottom: .33rem;
2019-12-15 04:32:40 +00:00
}
}
.note {
color: var(--note-color);
2019-11-08 20:34:06 +00:00
}
2019-06-06 13:44:06 +00:00
</style>