diff --git a/packages/examples/stories/docs/advanced/TabLink.jsx b/packages/examples/stories/docs/advanced/TabLink.jsx deleted file mode 100644 index 48f2156..0000000 --- a/packages/examples/stories/docs/advanced/TabLink.jsx +++ /dev/null @@ -1,16 +0,0 @@ -import React from "react"; - -// Storybook adds "/?path=" prefix to href anyway and there is no workaround... -const toAbs = (href) => location.origin + href; - -export const TabLink = ({ tabItem, panelItem }) => { - if (/^\/tab\//.test(location.pathname)) { - return React.cloneElement(tabItem, { - href: toAbs(tabItem.props.href), - }); - } - - return React.cloneElement(panelItem, { - href: toAbs(panelItem.props.href), - }); -}; diff --git a/packages/examples/stories/docs/advanced/docs.mdx b/packages/examples/stories/docs/advanced/docs.mdx index 129a4f1..a04e1a7 100644 --- a/packages/examples/stories/docs/advanced/docs.mdx +++ b/packages/examples/stories/docs/advanced/docs.mdx @@ -3,7 +3,6 @@ import { TabsState } from "@storybook/components"; import { Figma } from "@storybook/addon-designs/blocks"; -import { TabLink } from "./TabLink"; import * as AdvancedStories from "./index.stories"; @@ -99,10 +98,10 @@ The addon can render contents to `Design` tab instead of in an addon panel. To do this, you need to set `"tab"` to a `renderTarget` preset option. The default value is `"panel"`. -Go back to panel mode} - panelItem={Go to tab mode} -/> +{location.pathname.startsWith('/tab/') + ? Go back to panel mode + : Go to tab mode +} ```ts // .storybook/main.ts