Skip to content

Commit

Permalink
feat: ✨ add stories to both not found and error pages
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmy-guzman committed Nov 10, 2024
1 parent f98ac1c commit 636d318
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 7 deletions.
10 changes: 10 additions & 0 deletions .storybook/preview.ts → .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import "../src/main.css";
import type { Preview } from "@storybook/react";

import { withThemeByDataAttribute } from "@storybook/addon-themes";
import { createRouter, RouterContextProvider } from "@tanstack/react-router";

import { routeTree } from "@/route-tree.gen";

const router = createRouter({ routeTree });

const preview = {
decorators: [
Expand All @@ -14,6 +19,11 @@ const preview = {
light: "light",
},
}),
(story) => {
return (
<RouterContextProvider router={router}>{story()}</RouterContextProvider>
);
},
],

parameters: {
Expand Down
Binary file modified bun.lockb
Binary file not shown.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@
"prettier": "@jimmy.codes/prettier-config",
"dependencies": {
"@tanstack/react-query": "5.59.20",
"@tanstack/react-router": "1.79.0",
"@tanstack/react-router": "1.81.1",
"clsx": "2.1.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"tailwind-merge": "2.5.4"
},
"devDependencies": {
"@iconify-json/logos": "1.2.3",
"@iconify-json/lucide": "1.2.12",
"@iconify-json/lucide": "1.2.13",
"@iconify/tailwind": "1.1.3",
"@jimmy.codes/eslint-config": "3.8.0",
"@jimmy.codes/eslint-config": "3.11.1",
"@jimmy.codes/prettier-config": "1.3.0",
"@playwright/test": "1.48.2",
"@storybook/addon-a11y": "8.4.2",
Expand All @@ -48,7 +48,7 @@
"@storybook/react-vite": "8.4.2",
"@tailwindcss/typography": "0.5.15",
"@tanstack/react-query-devtools": "5.59.20",
"@tanstack/router-devtools": "1.79.0",
"@tanstack/router-devtools": "1.81.1",
"@tanstack/router-vite-plugin": "1.79.0",
"@testing-library/dom": "10.4.0",
"@testing-library/jest-dom": "6.6.3",
Expand All @@ -69,17 +69,17 @@
"happy-dom": "15.11.0",
"is-ci": "3.0.1",
"jiti": "2.4.0",
"knip": "5.36.3",
"knip": "5.36.5",
"lefthook": "1.8.2",
"msw": "2.6.2",
"msw": "2.6.3",
"postcss": "8.4.47",
"prettier": "3.3.3",
"storybook": "8.4.2",
"tailwindcss": "3.4.14",
"turbo": "2.2.3",
"typescript": "5.6.3",
"vite": "5.4.10",
"vite-tsconfig-paths": "5.1.0",
"vite-tsconfig-paths": "5.1.2",
"vitest": "2.1.4"
},
"packageManager": "[email protected]"
Expand Down
18 changes: 18 additions & 0 deletions src/pages/error.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { Meta, StoryObj } from "@storybook/react";

import { Error as ErrorComponent } from "./error";

const meta = {
component: ErrorComponent,
title: "Pages/Error",
} satisfies Meta<typeof ErrorComponent>;

export default meta;

type Story = StoryObj<typeof ErrorComponent>;

export const Error: Story = {
args: {
error: { message: "Something went wrong!", name: "Error" },
},
};
14 changes: 14 additions & 0 deletions src/pages/not-found.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { Meta, StoryObj } from "@storybook/react";

import { NotFound as NotFoundComponent } from "./not-found";

const meta = {
component: NotFoundComponent,
title: "Pages/NotFound",
} satisfies Meta<typeof NotFound>;

export default meta;

type Story = StoryObj<typeof NotFoundComponent>;

export const NotFound: Story = {};

0 comments on commit 636d318

Please sign in to comment.