-
-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Jarsen <31397967+Jarsen136@users.noreply.github.com> Co-authored-by: Viki Val <viktorko99@gmail.com>
- Loading branch information
1 parent
bc0dc72
commit 8f94bba
Showing
10 changed files
with
85 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,57 @@ | ||
<template> | ||
<b-image | ||
:src="src || placeholder" | ||
:src-fallback="placeholder" | ||
:alt="alt" | ||
ratio="1by1" | ||
:class="customClass" | ||
:rounded="rounded" | ||
data-cy="type-image" | ||
@error="onImageError"> | ||
<template #placeholder> | ||
<NeoSkeleton full-size no-margin :circle="rounded" /> | ||
</template> | ||
</b-image> | ||
<figure class="image-wrapper image is-1by1" :class="customClass"> | ||
<transition name="fade"> | ||
<img | ||
:src="imageSrc || placeholder" | ||
:alt="alt" | ||
:class="['has-ratio', { 'is-rounded': rounded }]" | ||
@load="onImageLoad" | ||
@error="onImageError" /> | ||
</transition> | ||
<transition name="fade"> | ||
<slot v-if="!loaded" name="placeholder"> | ||
<NeoSkeleton full-size no-margin :circle="rounded" /> | ||
</slot> | ||
</transition> | ||
</figure> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { NeoSkeleton } from '@kodadot1/brick' | ||
const { $consola } = useNuxtApp() | ||
const { placeholder } = useTheme() | ||
defineProps({ | ||
src: { type: String, default: '' }, | ||
alt: { type: String, default: 'KodaDot NFT minted multimedia' }, | ||
customClass: { type: String, default: '' }, | ||
rounded: Boolean, | ||
}) | ||
const props = withDefaults( | ||
defineProps<{ | ||
src: string | ||
alt?: string | ||
customClass?: string | ||
rounded?: boolean | ||
}>(), | ||
{ | ||
src: '', | ||
alt: '', | ||
customClass: '', | ||
} | ||
) | ||
function onImageError(ev: Event, src: string) { | ||
$consola.error('[BasicImage] to load:', src, ev) | ||
const imageSrc = ref(props.src) | ||
const loaded = ref(false) | ||
const onImageLoad = () => { | ||
loaded.value = true | ||
} | ||
const onImageError = (ev: Event) => { | ||
$consola.error('[BasicImage] to load:', props.src, ev) | ||
imageSrc.value = placeholder.value | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.image-wrapper { | ||
padding-top: 100%; | ||
img { | ||
object-fit: cover; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,3 @@ export type NFTEntitiesWithCount<T> = { | |
export type WithData<T> = { | ||
data: T | ||
} | ||
|