Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Commit f8b2843

Browse files
committed
fix: image aspect ratios
1 parent 4383370 commit f8b2843

File tree

7 files changed

+44
-26
lines changed

7 files changed

+44
-26
lines changed

components/Character/Item.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const thumbnail = computed(() => {
4848
v-if="thumbnail"
4949
:src="thumbnail"
5050
:alt="data?.name"
51-
class="h-36 w-24"
51+
class="aspect-4/6 min-h-36 w-24"
5252
/>
5353
</div>
5454
<p class="text-xl">

components/Comic/Tile.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ defineProps({
2222
<cv-tile
2323
v-if="comic"
2424
kind="clickable"
25-
class="m-4 h-96"
25+
class="m-4"
2626
>
2727
<external-image
2828
:src="`${comic?.thumbnail?.path}.${comic?.thumbnail?.extension}`"
2929
:alt="comic?.name"
30-
class="size-full object-left"
30+
class="aspect-4/6 min-h-80 w-full object-cover object-left"
3131
/>
3232
<div v-if="comic?.error">
3333
Error loading data

components/Event/DataRow.vue

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
11
<script setup>
22
import { DateTime } from 'luxon'
33
4+
/**
5+
* @typedef MarvelEventAvailable
6+
* @propery {number} available
7+
*/
8+
9+
/**
10+
* @typedef MarvelEvent
11+
* @property {string} start
12+
* @property {string} end
13+
* @property {string} title
14+
* @property {string} description
15+
* @property {ComicImage} thumbnail
16+
* @property {MarvelEventAvailable} characters
17+
* @property {MarvelEventAvailable} comics
18+
*/
19+
420
const props = defineProps({
521
data: {
6-
type: Object,
22+
type: /** @type MarvelEvent */ Object,
723
required: true,
824
},
925
expandable: { type: Boolean, default: false },

components/ExternalImage.vue

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,19 @@ function onImageLoaded() {
1212
</script>
1313

1414
<template>
15-
<img
16-
:src="src"
17-
:alt="alt"
18-
class="opacity-0 blur-lg transition-all duration-500"
19-
:class="[{ 'opacity-100 blur-none ': imgLoaded }, $attrs['class']]"
20-
@load="onImageLoaded"
21-
>
22-
<!-- Show a placeholder while loading -->
23-
<cv-skeleton-text
24-
v-if="!imgLoaded"
25-
width="100%"
26-
/>
15+
<div>
16+
<img
17+
:src="src"
18+
:alt="alt"
19+
class="opacity-0 blur-lg transition-all duration-500"
20+
:class="[{ 'opacity-100 blur-none ': imgLoaded }, $attrs['class']]"
21+
@load="onImageLoaded"
22+
>
23+
<!-- Show a placeholder while loading -->
24+
<cv-skeleton-text
25+
v-if="!imgLoaded"
26+
/>
27+
</div>
2728
</template>
2829

2930
<style scoped lang="scss">

components/TheHeader.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ const otherApps = ref([
2929
{ id: 'hello-vue', name: 'Hello Carbon Vue', link: 'https://github.com/IBM/hello-carbon-vue3' },
3030
{ id: 'carbon-vue', name: 'Carbon Vue Storybook', link: 'https://vue.carbondesignsystem.com/' },
3131
])
32+
33+
// close the sideNav if somethihg is clicked there.
34+
function sideNav() {
35+
document?.activeElement?.blur()
36+
}
3237
</script>
3338
3439
<template>
@@ -178,7 +183,7 @@ const otherApps = ref([
178183
:fixed="true"
179184
:expanded="false"
180185
>
181-
<cv-side-nav-items>
186+
<cv-side-nav-items @click="sideNav">
182187
<cv-side-nav-link
183188
id="header-side-nav-home"
184189
to="/"

composables/useMarvelEvents.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@ const marvelEventData = ref({
66
limit: 0,
77
total: 0,
88
count: 0,
9-
results: [
10-
{ loading: true },
11-
{ loading: true },
12-
{ loading: true },
13-
{ loading: true },
14-
],
9+
results: [],
1510
},
1611
})
1712

pages/Events.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
import { View20 as ShowAllIcon, ViewOff20 as HideIcon } from '@carbon/icons-vue'
33
44
const marvelEvents = useMarvelEvents()
5-
const loading = computed(() => {
6-
return marvelEvents.value?.data?.results?.length <= 0
7-
})
5+
86
const marveEventsList = computed(() => {
97
return marvelEvents.value?.data.results || []
108
})
9+
const loading = computed(() => {
10+
return marveEventsList.value.length <= 0
11+
})
1112
1213
const { t, locale } = useI18n()
1314

0 commit comments

Comments
 (0)