diff --git a/.storybook/main.js b/.storybook/main.js index 4e442ef8..0248aeb3 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -1,3 +1,5 @@ +import MonacoWebpackPlugin from "monaco-editor-webpack-plugin"; + const path = require("path"); const { mergeDeepLeft } = require("ramda"); @@ -32,6 +34,13 @@ module.exports = { "@bigbinary/neetoui": path.resolve(__dirname, "..", "src"), }; + config.plugins = [ + ...config.plugins, + new MonacoWebpackPlugin({ + languages: ["javascript"], + }), + ]; + return config; }, diff --git a/package.json b/package.json index cccbb792..5ff29b64 100644 --- a/package.json +++ b/package.json @@ -148,6 +148,7 @@ "linkifyjs": "4.1.2", "lint-staged": "11.0.0", "monaco-editor": "^0.50.0", + "monaco-editor-webpack-plugin": "^7.1.0", "postcss": "^8.4.17", "postcss-import": "^15.0.0", "postcss-loader": "^7.0.1", diff --git a/stories/Introduction/LivePlayground.stories.jsx b/stories/Introduction/LivePlayground.stories.jsx index 82045260..8b455851 100644 --- a/stories/Introduction/LivePlayground.stories.jsx +++ b/stories/Introduction/LivePlayground.stories.jsx @@ -8,23 +8,15 @@ import * as components from "components"; import * as FormikComponents from "formikcomponents"; import * as hooks from "hooks"; +import { DEFAULT_PLAYGROUND_CODE } from "./constants"; + import LivePlaygroundDocs from "!raw-loader!./LivePlaygroundDocs/LivePlaygroundUsage.mdx"; const LivePlayground = () => { - const [code, setCode] = useState("\n"); + const [code, setCode] = useState(DEFAULT_PLAYGROUND_CODE); return (
-
- -
-

Preview

{
+
+ +
); }; diff --git a/stories/Introduction/LivePlaygroundDocs/LivePlaygroundUsage.mdx b/stories/Introduction/LivePlaygroundDocs/LivePlaygroundUsage.mdx index 16879243..8bd430d6 100644 --- a/stories/Introduction/LivePlaygroundDocs/LivePlaygroundUsage.mdx +++ b/stories/Introduction/LivePlaygroundDocs/LivePlaygroundUsage.mdx @@ -10,27 +10,3 @@ To use Formik components, please use them from the FormikComponents namespace: ` Additionally, React is also set in the scope. To use hooks, you can call them as `React.useState`: - -`() => { - const [isOpen, setIsOpen] = React.useState(false) - return (
-
) -} -` diff --git a/stories/Introduction/constants.js b/stories/Introduction/constants.js new file mode 100644 index 00000000..cc536c38 --- /dev/null +++ b/stories/Introduction/constants.js @@ -0,0 +1,24 @@ +export const DEFAULT_PLAYGROUND_CODE = `() => { + const [isOpen, setIsOpen] = React.useState(false); + + return (
+
) +} +`; diff --git a/yarn.lock b/yarn.lock index 2d73dd9a..32c85bb0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10888,7 +10888,7 @@ loader-runner@^4.2.0: resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1" integrity sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg== -loader-utils@^2.0.0, loader-utils@^2.0.4: +loader-utils@^2.0.0, loader-utils@^2.0.2, loader-utils@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.4.tgz#8b5cb38b5c34a9a018ee1fc0e6a066d1dfcc528c" integrity sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw== @@ -11265,6 +11265,13 @@ modern-normalize@^1.1.0: resolved "https://registry.yarnpkg.com/modern-normalize/-/modern-normalize-1.1.0.tgz#da8e80140d9221426bd4f725c6e11283d34f90b7" integrity sha512-2lMlY1Yc1+CUy0gw4H95uNN7vjbpoED7NNRSBHE25nWfLBdmMzFCsPshlzbxHz+gYMcBEUN8V4pU16prcdPSgA== +monaco-editor-webpack-plugin@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/monaco-editor-webpack-plugin/-/monaco-editor-webpack-plugin-7.1.0.tgz#16f265c2b5dbb5fe08681b6b3b7d00d3c5b2ee97" + integrity sha512-ZjnGINHN963JQkFqjjcBtn1XBtUATDZBMgNQhDQwd78w2ukRhFXAPNgWuacaQiDZsUr4h1rWv5Mv6eriKuOSzA== + dependencies: + loader-utils "^2.0.2" + monaco-editor@^0.50.0: version "0.50.0" resolved "https://registry.yarnpkg.com/monaco-editor/-/monaco-editor-0.50.0.tgz#44e62b124c8aed224e1d310bbbe6ffd6d5122413"