Skip to content

Commit

Permalink
fix: sidebar toggle only for sidebar docs
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Aug 5, 2020
1 parent e9e0ebd commit eea21a6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ui/app/src/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import {
SidebarContext,
Header as AppHeader,
} from '@component-controls/components';
import { useConfig, useDocTypeCount } from '@component-controls/store';
import {
useConfig,
useDocTypeCount,
useCurrentDocument,
} from '@component-controls/store';
import { Search } from '@component-controls/blocks';

export interface HeaderProps {
Expand All @@ -25,6 +29,7 @@ export const Header: FC<HeaderProps> = ({ toolbar = {} }) => {
const { SidebarToggle, collapsed, responsive } = useContext(SidebarContext);
const docCounts = useDocTypeCount();
const config = useConfig();
const doc = useCurrentDocument();
const { pages } = config || {};
const leftActions: ActionItems = useMemo(() => {
const actions: ActionItems = [
Expand Down Expand Up @@ -62,7 +67,7 @@ export const Header: FC<HeaderProps> = ({ toolbar = {} }) => {
return (
<AppHeader>
<Box variant="appheader.container">
{collapsed && <SidebarToggle />}
{doc?.navSidebar && collapsed && <SidebarToggle />}
<ActionBar themeKey="toolbar" actions={leftActions} />
</Box>
<Box variant="appheader.container">
Expand Down

0 comments on commit eea21a6

Please sign in to comment.