diff --git a/.storybook/main.ts b/.storybook/main.ts index 07b0297..8266299 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -13,7 +13,7 @@ const config: StorybookConfig = { name: "@storybook/react-webpack5", options: {}, }, - staticDirs: ["../static"], + staticDirs: ["../static", "../public"], core: { builder: "webpack5", }, diff --git a/.storybook/preview.ts b/.storybook/preview.ts index d6efa04..c42734e 100644 --- a/.storybook/preview.ts +++ b/.storybook/preview.ts @@ -1,9 +1,17 @@ import type { Preview } from "@storybook/react" +import { initialize, mswLoader } from "msw-storybook-addon" import "./fonts.css" import "bootstrap/dist/css/bootstrap.min.css" import "../src/styles/style.css" +/* + * Initializes MSW + * See https://github.com/mswjs/msw-storybook-addon#configuring-msw + * to learn how to customize it + */ +initialize() + const preview: Preview = { parameters: { controls: { @@ -13,6 +21,7 @@ const preview: Preview = { }, }, }, + loaders: [mswLoader], // 👈 Add the MSW loader to all stories } export default preview diff --git a/gatsby-browser.js b/gatsby-browser.js index 7b70a2e..3110847 100644 --- a/gatsby-browser.js +++ b/gatsby-browser.js @@ -10,6 +10,7 @@ import PrefetchData from "./src/components/PrefetchData" import PageLayout from "./src/components/PageLayout" import { useBrowserStore } from "./src/store" import { versionService } from "./src/services" +import Page from "./src/components/Page" // Logs when the client route changes export function onRouteUpdate({ location, prevLocation }) { @@ -64,7 +65,16 @@ export function wrapRootElement({ element, props }) { // wraps every page in a component export function wrapPageElement({ element, props }) { console.log("[gatsby-browser]@wrapPageElement", props) - return {element} + + if (props.path === "/plans/") { + return hello{element} + } + // display all other pages a s modals + return ( +
+ {element} +
+ ) } export function shouldUpdateScroll() { diff --git a/package.json b/package.json index bd24927..8e183fd 100644 --- a/package.json +++ b/package.json @@ -57,10 +57,21 @@ "@storybook/react": "^8.2.9", "@storybook/react-webpack5": "^8.2.9", "@storybook/test": "^8.2.9", + "@types/node": "^22.3.0", + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", "cors": "^2.8.5", "express": "^4.19.2", "http-proxy-middleware": "^3.0.0", + "msw": "^2.3.5", + "msw-storybook-addon": "^2.0.3", "prop-types": "^15.8.1", - "storybook": "^8.2.9" + "storybook": "^8.2.9", + "typescript": "^5.5.4" + }, + "msw": { + "workerDirectory": [ + "public" + ] } -} +} \ No newline at end of file diff --git a/src/components/Alert.js b/src/components/Alert.tsx similarity index 56% rename from src/components/Alert.js rename to src/components/Alert.tsx index beca690..04139e8 100644 --- a/src/components/Alert.js +++ b/src/components/Alert.tsx @@ -2,11 +2,22 @@ import React from "react" import { InfoCircle } from "iconoir-react" import "./Alert.css" -const Alert = ({ value = "", className = "" }) => { +export interface AlertProps { + value?: string + className?: string + children?: React.ReactNode +} + +const Alert: React.FC = ({ + value = "", + className = "", + children, +}) => { return (
{value} + {children}
) } diff --git a/src/components/Header.js b/src/components/Header.js index 1c6917d..e45d15c 100644 --- a/src/components/Header.js +++ b/src/components/Header.js @@ -24,8 +24,8 @@ const Header = () => {