Skip to content

Commit a520db0

Browse files
committed
Storybook - Mock NuxtImg on prod - Fix ts errors
1 parent 6f7605a commit a520db0

3 files changed

Lines changed: 12 additions & 16 deletions

File tree

.storybook/preview.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
import { defineComponent } from "vue";
22
import type { Preview } from "@nuxtjs/storybook";
33

4-
// Decorator to globally mock NuxtImg for Storybook
4+
// Global NuxtImg mock for Storybook
5+
const NuxtImgMock = defineComponent({
6+
props: ["src", "alt", "width", "height", "class", "style"],
7+
template: `<img :src="src" :alt="alt" :width="width" :height="height" :class="class" :style="style" />`,
8+
});
9+
510
export const decorators = [
6-
(story: any) =>
11+
(story: () => unknown) =>
712
defineComponent({
8-
components: { story },
13+
components: { story, NuxtImg: NuxtImgMock },
914
template: "<story />",
10-
setup() {
11-
// Register NuxtImg globally using Vue's globalThis
12-
if (typeof window !== "undefined" && (globalThis as any).$nuxt) {
13-
(globalThis as any).$nuxt.vueApp.component("NuxtImg", {
14-
props: ["src", "alt", "width", "height", "class", "style"],
15-
template: `<img :src="src" :alt="alt" :width="width" :height="height" :class="class" :style="style" />`,
16-
});
17-
}
18-
},
1915
}),
2016
];
2117

app/components/03.organisms/treatment-consultant/TreatmentConsultant.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
</div>
215215
<div class="colour-finder__details-card">
216216
<div class="colour-finder__details-header">
217-
<span class="colour-finder__details-method-label">Recommended Method</span>
217+
<span class="colour-finder__details-method-label">Processes Required</span>
218218
<span class="colour-finder__details-method-badge">{{ colourRecommendation.method }}</span>
219219
</div>
220220
<div class="colour-finder__details-list">
@@ -1860,9 +1860,9 @@ const suitabilityConfig: Record<Suitability, { icon: string; label: string }> =
18601860
}
18611861
18621862
.colour-finder__summary-swatch {
1863-
inline-size: 3rem;
1864-
block-size: 3rem;
1865-
border-radius: 50%;
1863+
aspect-ratio: 1 / 1;
1864+
block-size: 8rem;
1865+
border-radius: 100vw;
18661866
margin-block-end: var(--_spacing-sm);
18671867
border: 1px solid color-mix(in srgb, var(--_foreground) 10%, transparent);
18681868
overflow: hidden;
54.7 KB
Loading

0 commit comments

Comments
 (0)