diff --git a/.gitignore b/.gitignore index 8f7d792..00c36cd 100644 --- a/.gitignore +++ b/.gitignore @@ -12,11 +12,9 @@ dist dist-ssr *.local *-lock.json +pnpm-lock.yaml # Editor directories and files -.vscode -.vscode/* -!.vscode/extensions.json .idea .DS_Store *.suo diff --git a/.storybook/document.tsx b/.storybook/document.tsx deleted file mode 100644 index 1cab29a..0000000 --- a/.storybook/document.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from "react"; -import { DocsPage, DocsContainer } from "@storybook/addon-docs"; -import { Source } from "@storybook/blocks"; - -const CustomDocsPage = (props) => { - const { context } = props; - - const importStatement = ` - // Import statement - import <> from '@react-noxui'; - `; - - return ( - - - - - ); -}; - -export default CustomDocsPage; diff --git a/.storybook/main.ts b/.storybook/main.ts index d730b22..84f5700 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -1,19 +1,19 @@ import type { StorybookConfig } from "@storybook/react-vite"; const config: StorybookConfig = { - stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], - addons: [ - "@storybook/addon-onboarding", - "@storybook/addon-essentials", - "@storybook/addon-interactions", - "@storybook/addon-styling-webpack", - ], - framework: { - name: "@storybook/react-vite", - options: {}, - }, - staticDirs: ["../public"], - previewHead: (head) => ` + stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], + addons: [ + "@storybook/addon-onboarding", + "@storybook/addon-essentials", + "@storybook/addon-interactions", + "@storybook/addon-styling-webpack", + ], + framework: { + name: "@storybook/react-vite", + options: {}, + }, + staticDirs: ["../public"], + previewHead: head => ` ${head} ${` { - const { args } = context; - const { oldValue, newValue } = args; +function withJsonEditor(Story, context) { + const { args } = context; + const { oldValue, newValue } = args; - const [oldJson, setOldJson] = useState(JSON.stringify(oldValue, null, 2)); - const [newJson, setNewJson] = useState(JSON.stringify(newValue, null, 2)); - const [oldJsonError, setOldJsonError] = useState(""); - const [newJsonError, setNewJsonError] = useState(""); - const [parsedOldValue, setParsedOldValue] = useState(oldValue); - const [parsedNewValue, setParsedNewValue] = useState(newValue); + const [oldJson, setOldJson] = useState(JSON.stringify(oldValue, null, 2)); + const [newJson, setNewJson] = useState(JSON.stringify(newValue, null, 2)); + const [oldJsonError, setOldJsonError] = useState(""); + const [newJsonError, setNewJsonError] = useState(""); + const [parsedOldValue, setParsedOldValue] = useState(oldValue); + const [parsedNewValue, setParsedNewValue] = useState(newValue); - const validateJson = (jsonString: string) => { - try { - return { error: "", parsed: JSON.parse(jsonString) }; - } catch (error) { - return { error: "Invalid JSON format", parsed: null }; - } - }; + const validateJson = (jsonString: string) => { + try { + return { error: "", parsed: JSON.parse(jsonString) }; + } + catch { + return { error: "Invalid JSON format", parsed: null }; + } + }; - useEffect(() => { - const { error, parsed } = validateJson(oldJson); - setOldJsonError(error); - if (!error) { - setParsedOldValue(parsed); - } - }, [oldJson]); + useEffect(() => { + const { error, parsed } = validateJson(oldJson); + setOldJsonError(error); + if (!error) { + setParsedOldValue(parsed); + } + }, [oldJson]); - useEffect(() => { - const { error, parsed } = validateJson(newJson); - setNewJsonError(error); - if (!error) { - setParsedNewValue(parsed); - } - }, [newJson]); + useEffect(() => { + const { error, parsed } = validateJson(newJson); + setNewJsonError(error); + if (!error) { + setParsedNewValue(parsed); + } + }, [newJson]); - return ( -
-
-
-

Old Value

-