Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replace path to relative in vc-shape and vc-icon #1521

Merged
merged 2 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading