forked from openedx/frontend-app-authoring
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOutlineSidebar.tsx
More file actions
43 lines (36 loc) · 1.12 KB
/
OutlineSidebar.tsx
File metadata and controls
43 lines (36 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { breakpoints } from '@openedx/paragon';
import { useMediaQuery } from 'react-responsive';
import { Sidebar } from '@src/generic/sidebar';
import OutlineHelpSidebar from './OutlineHelpSidebar';
import { useOutlineSidebarContext } from './OutlineSidebarContext';
import { isOutlineNewDesignEnabled } from '../utils';
const OutlineSideBar = () => {
const isMedium = useMediaQuery({ maxWidth: breakpoints.medium.maxWidth });
const {
currentPageKey,
setCurrentPageKey,
isOpen,
toggle,
sidebarPages,
} = useOutlineSidebarContext();
// Returns the previous help sidebar component if the waffle flag is disabled
if (!isOutlineNewDesignEnabled()) {
// On screens smaller than medium, the help sidebar is shown below the course outline
const colSpan = isMedium ? 'col-12' : 'col-3';
return (
<div className={colSpan}>
<OutlineHelpSidebar />
</div>
);
}
return (
<Sidebar
pages={sidebarPages}
currentPageKey={currentPageKey}
setCurrentPageKey={setCurrentPageKey}
isOpen={isOpen}
toggle={toggle}
/>
);
};
export default OutlineSideBar;