This commit is contained in:
Andrea Vos 2025-01-02 12:11:48 +01:00
parent f559f6778f
commit adff6efe7a
2 changed files with 7 additions and 6 deletions

View File

@ -2,7 +2,7 @@
<span <span
v-if="v && svgs[v as string] !== undefined" v-if="v && svgs[v as string] !== undefined"
v-html="svgs[v as string]" v-html="svgs[v as string]"
/> ></span>
<img <img
v-else-if="iconSource" v-else-if="iconSource"
:src="iconSource" :src="iconSource"
@ -17,11 +17,12 @@
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import type { PropType } from 'vue'; import type { PropType } from 'vue';
import BlueSky from '~/public/img/bluesky.svg'; import BlueSky from '~/public/img/bluesky.svg';
const svgDataToHtml = (svgDataString: string): string => decodeURI(svgDataString).replace(/^.*<svg /, '<svg class="icon" ') const svgDataToHtml = (svgDataString: string): string => decodeURI(svgDataString).replace(/^.*<svg /, '<svg class="icon" ');
const buildQueue = (v: string | (string | undefined)[] | null): { value: string; fallbacks: string[], svgs: Record<string, any> } => { const buildQueue = (v: string | (string | undefined)[] | null): { value: string; fallbacks: string[]; svgs: Record<string, any> } => {
const rawValues = Array.isArray(v) ? v : [v]; const rawValues = Array.isArray(v) ? v : [v];
let values = rawValues.filter((x) => !!x) as string[]; let values = rawValues.filter((x) => !!x) as string[];
@ -33,8 +34,8 @@ const buildQueue = (v: string | (string | undefined)[] | null): { value: string;
value: values.shift()!, value: values.shift()!,
fallbacks: values, fallbacks: values,
svgs: { svgs: {
'bluesky': svgDataToHtml(BlueSky), bluesky: svgDataToHtml(BlueSky),
} },
}; };
}; };

View File

@ -28,7 +28,7 @@
<li>Realizacja redesignu: <nuxt-link to="/@andrea">@andrea</nuxt-link></li> <li>Realizacja redesignu: <nuxt-link to="/@andrea">@andrea</nuxt-link></li>
<li>Flaga osób niebinarych <a href="https://commons.wikimedia.org/wiki/File:Nonbinary_flag.svg" target="_blank" rel="noopener">Kye Rowan</a> (public domain)</li> <li>Flaga osób niebinarych <a href="https://commons.wikimedia.org/wiki/File:Nonbinary_flag.svg" target="_blank" rel="noopener">Kye Rowan</a> (public domain)</li>
<li>Wektor łosia: <a href="https://commons.wikimedia.org/wiki/File:Coat_of_arms_of_Ontario,_Canada.svg" target="_blank" rel="noopener">Herb Ontario</a> (public domain)</li> <li>Wektor łosia: <a href="https://commons.wikimedia.org/wiki/File:Coat_of_arms_of_Ontario,_Canada.svg" target="_blank" rel="noopener">Herb Ontario</a> (public domain)</li>
<li>Wektor łoma: <a href=https://www.vecteezy.com/free-vector/crowbar target="_blank" rel="noopener">Vecteezy</a></li> <li>Wektor łoma: <a href="https://www.vecteezy.com/free-vector/crowbar" target="_blank" rel="noopener">Vecteezy</a></li>
</ul> </ul>
</details> </details>
</figure> </figure>