Skip to content

Commit

Permalink
fix: page type nogt existing in theme
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Feb 20, 2021
1 parent fd9f766 commit 6ff6122
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ui/app/src/DocPage/DocPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @jsx jsx */
import { FC } from 'react';
import { jsx } from 'theme-ui';
import { useCurrentDocument } from '@component-controls/store';
import { useCurrentDocument, useTheme } from '@component-controls/store';
import { PageContainer } from '../PageContainer';
import { SidebarsPage, DocPageProps } from '../SidebarsPage';
import { CategoryPage } from '../CategoryPage';
Expand All @@ -16,16 +16,20 @@ export const DocPage: FC<Omit<DocPageProps, 'doc'> & { category?: string }> = ({
...props
}) => {
const doc = useCurrentDocument();
const theme = useTheme();
if (category) {
return <CategoryPage type={type} category={category} />;
}
const hasNoSideBars = !doc?.navSidebar && !doc?.contextSidebar;
const isFullPage = doc?.fullPage;
if (hasNoSideBars || isFullPage) {
const variant = isFullPage
? 'full'
: theme?.pagecontainer?.[type] || 'default';
return (
<PageContainer
type={type}
variant={`pagecontainer.${isFullPage ? 'full' : type}`}
variant={`pagecontainer.${variant}`}
id="content"
/>
);
Expand Down

0 comments on commit 6ff6122

Please sign in to comment.