diff options
author | Kirill Rogovoy <[email protected]> | 2021-07-20 21:24:52 +0300 |
---|---|---|
committer | Kirill Rogovoy <[email protected]> | 2021-07-20 21:24:52 +0300 |
commit | 5f4611d65e40eae3ca6191a15f68d69ea5a1c4cb (patch) | |
tree | 273dfc086444533d86d580961c92ba8d14781a67 /storybook/toggle-storybook.web.tsx | |
parent | f0bf4e7afdcd8b02a62be45ab3e7d047ed865a79 (diff) |
WIP
Diffstat (limited to 'storybook/toggle-storybook.web.tsx')
-rw-r--r-- | storybook/toggle-storybook.web.tsx | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/storybook/toggle-storybook.web.tsx b/storybook/toggle-storybook.web.tsx deleted file mode 100644 index 9da2ada..0000000 --- a/storybook/toggle-storybook.web.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import React, { useState, useEffect } from 'react' -import * as QueryString from 'query-string' - -interface StorybookQueryParams { - storybook?: boolean -} - -export const ToggleStorybook = (props) => { - const [StorybookUIRoot, setStorybookUIRoot] = useState<any>(null) - const [queryParams, setQueryParams] = useState<StorybookQueryParams>({}) - - useEffect(() => { - if (__DEV__) { - // Load the storybook UI once - setStorybookUIRoot(() => require('./storybook').StorybookUIRoot) - } - }, []) - - useEffect(() => { - if (__DEV__) { - setQueryParams(QueryString.parse(window.location.search)) - } - }, [window.location.search]) - - if (queryParams?.storybook) { - return StorybookUIRoot ? <StorybookUIRoot /> : null - } else { - return props.children - } -} |