Skip to content

Commit

Permalink
refactor: storybook router decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
mwargan committed Mar 6, 2024
1 parent b7ffce9 commit a63014a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
7 changes: 7 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { type App } from "vue";
import { EventsPlugin } from "../src/eventBus/events";
import { createPinia } from "pinia";
import { navIsLoading } from "../src/router";
import { vueRouter } from "storybook-vue3-router";

setup((app: App) => {
app.use(createPinia());
Expand All @@ -29,4 +30,10 @@ const preview: Preview = {
},
};

preview.decorators = [
/* this is the basic setup with no params passed to the decorator */
vueRouter(),
];


export default preview;
8 changes: 0 additions & 8 deletions src/stories/BaseButton.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import type { Meta, StoryObj } from "@storybook/vue3";

import BaseButton from "@/components/BaseButton.vue";

import { vueRouter } from "storybook-vue3-router";

// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
const meta: Meta<typeof BaseButton> = {
title: "Components/BaseButton",
Expand Down Expand Up @@ -44,9 +42,3 @@ export const UsingToProp: Story = {
to: "/",
},
};

/* adding storybook-vue3-router decorator */
UsingToProp.decorators = [
/* this is the basic setup with no params passed to the decorator */
vueRouter(),
];
14 changes: 0 additions & 14 deletions src/stories/NavBar.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { Meta, StoryObj } from "@storybook/vue3";

import NavBar from "@/components/NavBar.vue";

import { vueRouter } from "storybook-vue3-router";
import { useUserStore } from "@/stores/user";

// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
Expand Down Expand Up @@ -38,16 +37,3 @@ export const LoggedOut: Story = {
href: "/",
},
};

/* adding storybook-vue3-router decorator */
LoggedIn.decorators = [
/* this is the basic setup with no params passed to the decorator */
/* this is the basic setup with no params passed to the decorator */
vueRouter(),
];

/* adding storybook-vue3-router decorator */
LoggedOut.decorators = [
/* this is the basic setup with no params passed to the decorator */
vueRouter(),
];

0 comments on commit a63014a

Please sign in to comment.