Skip to content

Commit 93bfccd

Browse files
committed
list: various style improvements and cards consistency. Show placeholder in case of no screenshots available
1 parent 7c6bb38 commit 93bfccd

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

components/list.vue

+15-4
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@ const config = useRuntimeConfig().public;
88
<div class="product-grid-item card">
99
<div class="product-grid-item-content">
1010
<router-link tag="li" :to="'/game/' + slotProps.data.slug">
11+
<!--
12+
If there's at least one screenshot of the game, pick the first one as the cover, otherwise go for the placeholder
13+
-->
1114
<img
1215
:src="
16+
slotProps.data.screenshots.length > 0 ?
1317
config.BASE_API_URL +
1418
'/entries/' +
1519
slotProps.data.slug +
1620
'/' +
17-
slotProps.data.screenshots[0]
21+
slotProps.data.screenshots[0] : 'https://raw.githubusercontent.com/gbdev/database/master/placeholder.png'
1822
"
1923
class="product-image"
2024
:alt="slotProps.data.title"
@@ -76,7 +80,6 @@ export default {
7680
box-shadow: 0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14),
7781
0 1px 3px 0 rgba(0, 0, 0, 0.12);
7882
border-radius: 4px;
79-
margin-bottom: 2rem;
8083
}
8184
8285
.p-dropdown {
@@ -96,19 +99,27 @@ a {
9699
97100
.product-image {
98101
width: 100%;
99-
aspect-ratio: 1;
102+
aspect-ratio: 1.1;
100103
object-fit: cover;
101104
margin-top: 0px;
105+
image-rendering: auto;
106+
image-rendering: crisp-edges;
107+
image-rendering: pixelated;
102108
}
103109
104110
.product-description {
105-
margin: 0 1rem 1rem 1rem;
111+
margin: 0 1rem 0.75rem 1rem;
106112
color: var(--text-color-secondary);
107113
white-space: nowrap;
108114
text-overflow: ellipsis;
109115
overflow: hidden;
110116
}
111117
118+
/* Adding a zero-width space character makes the author row takes the space anyway, so cards without this value won't take less height */
119+
.product-description:after {
120+
content: "\200b";
121+
}
122+
112123
.product-category-icon {
113124
vertical-align: middle;
114125
margin-right: 0.5rem;

0 commit comments

Comments
 (0)