diff --git a/.changeset/sharp-bobcats-grab.md b/.changeset/sharp-bobcats-grab.md new file mode 100644 index 0000000000..a548d4aa52 --- /dev/null +++ b/.changeset/sharp-bobcats-grab.md @@ -0,0 +1,5 @@ +--- +'@swisspost/design-system-components': patch +--- + +Made `post-icon` component use base tag href to define location of icons folder. diff --git a/packages/components/src/components/post-icon/post-icon.tsx b/packages/components/src/components/post-icon/post-icon.tsx index 6a48db0aba..d9a36e8d19 100644 --- a/packages/components/src/components/post-icon/post-icon.tsx +++ b/packages/components/src/components/post-icon/post-icon.tsx @@ -131,7 +131,8 @@ export class PostIcon { .querySelector('meta[name="design-system-settings"][data-post-icon-base]') ?.getAttribute('data-post-icon-base') ?? null; - const fileBase = `${this.base ?? metaBase ?? CDN_URL}/`.replace(/\/\/$/, '/'); + const baseHref = document.getElementsByTagName('base')[0]?.href; + const fileBase = `${this.base ?? metaBase ?? baseHref ?? CDN_URL}/`.replace(/\/\/$/, '/'); const fileName = `${this.name}.svg`; const filePath = `${fileBase}${fileName}`;