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

Update dependency @nuxtjs/storybook to v8.3.3 #5306

Merged
merged 4 commits into from
Jan 10, 2025
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
2 changes: 1 addition & 1 deletion frontend/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { StorybookConfig } from "@storybook-vue/nuxt"

const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
stories: ["../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
Expand Down
11 changes: 5 additions & 6 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,11 @@
"@intlify/shared": "^11.0.1",
"@nuxt/test-utils": "^3.15.1",
"@nuxtjs/i18n": "^9.1.1",
"@nuxtjs/storybook": "8.3.2",
"@nuxtjs/storybook": "8.3.3",
"@playwright/test": "1.49.1",
"@storybook-vue/nuxt": "8.3.2",
"@storybook/addon-essentials": "^8.3.6",
"@storybook/addon-interactions": "^8.3.6",
"@storybook/addon-links": "^8.3.6",
"@storybook/addon-essentials": "8.4.7",
"@storybook/addon-interactions": "8.4.7",
"@storybook/addon-links": "8.4.7",
"@testing-library/user-event": "^14.5.2",
"@testing-library/vue": "^8.1.0",
"@vitest/coverage-v8": "^2.1.4",
Expand All @@ -107,7 +106,7 @@
"npm-run-all2": "^7.0.0",
"nuxt": "^3.15.1",
"rimraf": "^6.0.1",
"storybook": "8.3.6",
"storybook": "8.4.7",
"talkback": "^4.2.0",
"typescript": "5.7.2",
"vitest": "^2.1.4",
Expand Down
3 changes: 3 additions & 0 deletions frontend/shared/constants/banners.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
export const bannerNature = ["info", "success", "warning", "error"] as const
export type BannerNature = (typeof bannerNature)[number]

export const bannerVariant = ["regular", "dark"] as const
export type BannerVariant = (typeof bannerVariant)[number]
4 changes: 2 additions & 2 deletions frontend/src/components/VBanner/VNotificationBanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
import { computed } from "vue"

import { BannerNature } from "#shared/constants/banners"
import type { BannerNature, BannerVariant } from "#shared/constants/banners"
import type { BannerId } from "#shared/types/banners"

import VIcon from "~/components/VIcon/VIcon.vue"
Expand All @@ -22,7 +22,7 @@ const props = withDefaults(
* the color variant of the banner; The dark variant is intended for use on
* bg-complementary pages.
*/
variant?: "regular" | "dark"
variant?: BannerVariant
/**
* the unique ID of the banner
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,37 @@ import { bannerNature } from "#shared/constants/banners"

import VNotificationBanner from "~/components/VBanner/VNotificationBanner.vue"

import type { StoryObj } from "@storybook/vue3"

const meta = {
title: "Components/VNotificationBanner",
component: VNotificationBanner,

argTypes: {
nature: { control: "select", options: [...bannerNature] },
variant: { control: "select", options: ["regular", "dark"] },
sNature: { control: "select", options: [...bannerNature] },
sVariant: { control: "select", options: ["regular", "dark"] },
onClose: { action: "close" },
},
args: {
nature: "info",
variant: "regular",
sNature: "info",
sVariant: "regular",
id: "banner",
},
}

export default meta
type Story = StoryObj<typeof meta>
type StoryTemplate = Omit<Story, "args">

const text =
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec nec justo eget felis facilisis fermentum."

const Template: StoryTemplate = {
const Template = {
render: (args) => ({
components: { VNotificationBanner },
setup() {
return () => h(VNotificationBanner, { ...args }, { default: () => text })
return () =>
h(
VNotificationBanner,
{ ...args, variant: args.sVariant, nature: args.sNature },
{ default: () => text }
)
},
}),
}
Expand All @@ -42,8 +43,8 @@ export const Default = {
name: "Default",

args: {
nature: "success",
variant: "regular",
sNature: "success",
sVariant: "regular",
},
}

Expand All @@ -52,7 +53,7 @@ export const Dark = {
name: "Dark",

args: {
nature: "info",
variant: "dark",
sNature: "info",
sVariant: "dark",
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ const meta = {
},

argTypes: {
size: { options: ["small", "medium"], control: { type: "select" } },
sSize: { options: ["small", "medium"], control: { type: "select" } },

useLinks: { control: { type: "boolean" } },
},

args: {
size: "medium",
sSize: "medium",
useLinks: false,
additionalTypes: false,
},
Expand All @@ -36,10 +36,10 @@ export const Default = {
h(
"div",
{
style: args.size === "small" ? "width: max-content;" : "",
style: args.sSize === "small" ? "width: max-content;" : "",
class: "wrapper p-2",
},
[h(VSearchTypes, args)]
[h(VSearchTypes, { ...args, size: args.sSize })]
)
},
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,21 @@ import { image } from "~~/test/unit/fixtures/image"

import VImageResult from "~/components/VImageResult/VImageResult.vue"

import type { Meta, StoryObj } from "@storybook/vue3"

const meta = {
title: "Components/VImageResult",
component: VImageResult,
} satisfies Meta<typeof VImageResult>

}
export default meta
type Story = StoryObj<typeof meta>

export const Default: Story = {
export const Default = {
render: (args) => ({
components: { VImageResult },
setup() {
return () =>
h("div", { class: "p-4 image-wrapper max-w-80" }, [
h("ol", { class: "flex flex-wrap gap-4" }, [h(VImageResult, args)]),
h("ol", { class: "flex flex-wrap gap-4" }, [
h(VImageResult, { ...args, aspectRatio: args.sAspectRatio }),
]),
])
},
}),
Expand All @@ -31,15 +29,15 @@ export const Default: Story = {
},

argTypes: {
aspectRatio: {
sAspectRatio: {
options: ["square", "intrinsic"],
control: { type: "select" },
},
image: { control: { type: "object" } },
},

args: {
aspectRatio: "intrinsic",
sAspectRatio: "intrinsic",
kind: "search",
searchTerm: "test",
relatedTo: "fake-uuid",
Expand Down
55 changes: 29 additions & 26 deletions frontend/src/components/meta/VButton.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,19 @@ export default {
},
},
args: {
size: "medium",
sSize: "medium",
},
argTypes: {
as: { options: buttonForms, control: { type: "radio" } },

variant: { options: buttonVariants, control: { type: "select" } },

// Use the name that's different from the prop name to hotfix
// the storybook bug when the prop with a custom type is not updated when
// the value is set in the URL.
sVariant: { options: buttonVariants, control: { type: "select" } },
sSize: { options: buttonSizes, control: { type: "select" } },
pressed: { control: "boolean" },

size: { options: buttonSizes, control: { type: "select" } },

disabled: { control: "boolean" },

focusableWhenDisabled: { control: "boolean" },

type: { control: "text" },

onClick: { action: "click" },
onMouseDown: { action: "mousedown" },
onKeydown: { action: "keydown" },
Expand All @@ -51,7 +47,6 @@ export default {
const Template = (args) => ({
components: { VButton },
setup() {
const { size, variant, ...rest } = args
return () =>
h("div", { class: "flex" }, [
h(
Expand All @@ -60,18 +55,20 @@ const Template = (args) => ({
id: "wrapper",
class: [
"px-4 h-16 flex items-center justify-center",
variant.startsWith("transparent") ? "bg-surface" : "bg-default",
args.sVariant.startsWith("transparent")
? "bg-surface"
: "bg-default",
],
},
[
h(
VButton,
{
size,
variant,
class: "description-bold",
href: "/",
...rest,
...args,
variant: args.sVariant,
size: args.sSize,
},
() => "Code is Poetry"
),
Expand All @@ -88,19 +85,27 @@ const TemplateWithIcons = (args) => ({
h("div", { class: "flex flex-col items-center gap-4 flex-wrap" }, [
h(
VButton,
{ variant: args.variant, size: args.size, "has-icon-start": true },
{
variant: args.sVariant,
size: args.sSize,
"has-icon-start": true,
},
() => [h(VIcon, { name: "replay" }), "Button"]
),
h(
VButton,
{ variant: args.variant, size: args.size, "has-icon-end": true },
{
variant: args.sVariant,
size: args.sSize,
"has-icon-end": true,
},
() => ["Button", h(VIcon, { name: "external-link" })]
),
h(
VButton,
{
variant: args.variant,
size: args.size,
variant: args.sVariant,
size: args.sSize,
"has-icon-start": true,
"has-icon-end": true,
},
Expand Down Expand Up @@ -130,6 +135,7 @@ const VariantsTemplate = (args) => ({
key: variant,
class: "description-bold",
...buttonArgs,
size: buttonArgs.sSize,
},
() => capitalCase(variant)
)
Expand All @@ -143,7 +149,7 @@ export const Default = {
name: "VButton",

args: {
variant: "filled-pink-8",
sVariant: "filled-pink-8",
},
}

Expand Down Expand Up @@ -175,16 +181,13 @@ export const Icons = {
name: "icons",

args: {
variant: "bordered-dark",
sVariant: "bordered-dark",
},

argTypes: {
pressed: { control: "boolean" },

size: { options: buttonSizes, control: { type: "radio" } },

variant: { options: buttonVariants },

sSize: { options: buttonSizes, control: { type: "radio" } },
sVariant: { options: buttonVariants },
disabled: { control: "boolean" },
},
}
8 changes: 4 additions & 4 deletions frontend/test/storybook/visual-regression/v-button.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test.describe("VButton", () => {
)
for (const variant of nonPressedVariants) {
test(`${variant} resting`, async ({ page }) => {
await gotoWithArgs(page, { variant })
await gotoWithArgs(page, { sVariant: variant })
await expectSnapshot(
page,
`${variant}-resting`,
Expand All @@ -25,7 +25,7 @@ test.describe("VButton", () => {
})

test(`${variant} hovered`, async ({ page }) => {
await gotoWithArgs(page, { variant })
await gotoWithArgs(page, { sVariant: variant })
await page.hover(buttonLocator)
await expectSnapshot(
page,
Expand All @@ -35,7 +35,7 @@ test.describe("VButton", () => {
})

test(`${variant} focused`, async ({ page }) => {
await gotoWithArgs(page, { variant })
await gotoWithArgs(page, { sVariant: variant })
await page.focus(buttonLocator)
await expectSnapshot(
page,
Expand All @@ -45,7 +45,7 @@ test.describe("VButton", () => {
})

test(`${variant} focused hovered`, async ({ page }) => {
await gotoWithArgs(page, { variant })
await gotoWithArgs(page, { sVariant: variant })
await page.focus(buttonLocator)
await page.hover(buttonLocator)
await expectSnapshot(
Expand Down
Loading
Loading