add an image to projects (which shows on all ProjectIcons except for offers)

This commit is contained in:
2024-05-23 20:51:40 -06:00
parent d08541fdae
commit af976ba838
6 changed files with 185 additions and 70 deletions

View File

@@ -1,5 +1,5 @@
<template>
<div v-html="generateIdenticon()" class="w-fit"></div>
<div v-html="generateIdenticon()" class="h-full w-full object-contain"></div>
</template>
<script lang="ts">
import { toSvg } from "jdenticon";
@@ -21,11 +21,16 @@ const BLANK_CONFIG = {
export default class ProjectIcon extends Vue {
@Prop entityId = "";
@Prop iconSize = 0;
@Prop imageUrl = "";
generateIdenticon() {
const config = this.entityId ? undefined : BLANK_CONFIG;
const svgString = toSvg(this.entityId, this.iconSize, config);
return svgString;
if (this.imageUrl) {
return `<img src="${this.imageUrl}" class="w-full h-full object-contain" />`;
} else {
const config = this.entityId ? undefined : BLANK_CONFIG;
const svgString = toSvg(this.entityId, this.iconSize, config);
return svgString;
}
}
}
</script>