Skip to content

Commit

Permalink
Merge branch 'dev' into fix/VCST-2464
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-dudarev authored Dec 27, 2024
2 parents 1f3b0dc + c158eac commit fea22d3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
14 changes: 12 additions & 2 deletions client-app/ui-kit/components/atoms/icon/vc-icon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<script setup lang="ts">
import DOMPurify from "dompurify";
import { ref, computed, watch } from "vue";
import { Logger } from "@/core/utilities";
interface IProps {
name?: string;
Expand All @@ -29,8 +30,17 @@ const style = computed(() =>
const sizeClass = computed(() => (typeof props.size === "string" ? `vc-icon--size--${props.size}` : ""));
async function loadIcon(name?: string) {
const response = (await import(`@/assets/icons/basic/${name}.svg?raw`)) as { default: string };
icon.value = DOMPurify.sanitize(response.default);
if (name) {
try {
const response = (await import(`../../../../assets/icons/basic/${name}.svg?raw`)) as { default: string };
icon.value = DOMPurify.sanitize(response.default);
} catch (error) {
Logger.error(`Failed to load icon: ${name}`, error);
icon.value = "";
}
} else {
icon.value = "";
}
}
watch(
Expand Down
12 changes: 11 additions & 1 deletion client-app/ui-kit/components/molecules/shape/vc-shape.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<script setup lang="ts">
import { computed, ref, watch } from "vue";
import { Logger } from "@/core/utilities";
interface IProps {
size?: number | string;
Expand All @@ -33,7 +34,16 @@ const style = computed(() => ({
}));
function loadIcon(name?: string) {
iconUrl.value = new URL(`/client-app/assets/icons/basic/${name}.svg`, import.meta.url).href ?? "";
if (name) {
try {
iconUrl.value = new URL(`../../../../assets/icons/basic/${name}.svg`, import.meta.url).href;
} catch (error) {
Logger.error(`Failed to load icon: ${name}`, error);
iconUrl.value = "";
}
} else {
iconUrl.value = "";
}
}
watch(
Expand Down

0 comments on commit fea22d3

Please sign in to comment.