Skip to content

Commit

Permalink
fix: mdx disable tabs pages
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Aug 9, 2020
1 parent 6a85426 commit 2c34748
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions core/core/src/document-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ export const getDocPath = (
doc?: Document,
pagesConfig?: PagesOnlyRoutes,
name: string = '',
activeTab?: string,
tab?: string,
): string => {
const { basePath = '', sideNav = {} } = pagesConfig?.[docType] || {};
const { storyPaths } = sideNav;
const activeTab = doc?.MDXPage ? undefined : tab;
if (storyPaths && doc && doc.stories && doc.stories.length > 0) {
return getStoryPath(doc.stories[0], doc, pagesConfig, activeTab);
}
Expand All @@ -48,9 +49,10 @@ export const getStoryPath = (
storyId?: string,
doc?: Document,
pagesConfig?: PagesOnlyRoutes,
activeTab?: string,
tab?: string,
): string => {
const docType = doc?.type || defDocType;
const activeTab = doc?.MDXPage ? undefined : tab;
if (!storyId) {
return getDocPath(docType, doc, pagesConfig, undefined, activeTab);
}
Expand Down
2 changes: 1 addition & 1 deletion ui/app/src/SidebarsPage/SidebarsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DocPageProps, SidebarsStoryPage } from './SidebarsStoryPage';

export const SidebarsPage: FC<Omit<DocPageProps, 'doc'>> = ({ type }) => {
const doc = useCurrentDocument();
if (doc && doc.MDXPage && !doc.stories?.length) {
if (doc && doc.MDXPage) {
return <SidebarsMDXPage type={type} doc={doc} />;
}
return doc ? <SidebarsStoryPage type={type} doc={doc} /> : null;
Expand Down

0 comments on commit 2c34748

Please sign in to comment.