Skip to content

Commit 94900a0

Browse files
authored
fix: make sidebar sticky and remove padding (#3057)
1 parent 3f531d5 commit 94900a0

5 files changed

Lines changed: 14 additions & 8 deletions

File tree

src/generic/resizable/Resizable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ export const ResizableBox = ({
6262

6363
return (
6464
<div
65-
className="resizable"
65+
className="resizable align-self-stretch d-flex"
6666
ref={boxRef}
6767
style={{ width: `${width}px` }}
6868
>
6969
{/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex, jsx-a11y/no-static-element-interactions */}
7070
<div className="resizable-handle" onMouseDown={onMouseDown} />
71-
<div className="w-100">
71+
<div className="w-100 d-flex">
7272
{children}
7373
</div>
7474
</div>

src/generic/sidebar/Sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export function Sidebar<T extends SidebarPages>({
9696
const activeKey = isOpen ? currentPageKey : undefined;
9797

9898
return (
99-
<Stack direction="horizontal" className="sidebar align-items-baseline ml-3" gap={2}>
99+
<Stack direction="horizontal" className="align-items-baseline flex-fill overflow-hidden" gap={2}>
100100
{(isOpen && !!currentPageKey) ?
101101
(
102102
<ResizableBox>

src/generic/sidebar/index.scss

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
position: sticky;
33
top: 0;
44
align-self: flex-start;
5+
height: 100vh;
56
max-height: 100vh;
7+
display: flex;
8+
flex-direction: column;
9+
margin-left: 1rem;
610

711
.sidebar-content {
812
flex: 0 1 auto;
913
min-width: 440px;
10-
overflow-y: auto;
11-
height: 100vh;
12-
max-height: 100vh;
14+
overflow: hidden auto;
1315

1416
/*
1517
* Change the styles for tabs in all sidebars.

src/plugin-slots/CourseAuthoringOutlineSidebarSlot/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const CourseAuthoringOutlineSidebarSlot = ({
77
courseName,
88
sections,
99
}: CourseAuthoringOutlineSidebarSlotProps) => (
10-
<div>
10+
<div className="sidebar">
1111
<PluginSlot
1212
id="org.openedx.frontend.authoring.course_outline_sidebar.v1"
1313
idAliases={['course_authoring_outline_sidebar_slot']}

src/plugin-slots/CourseAuthoringUnitSidebarSlot/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { PluginSlot } from '@openedx/frontend-plugin-framework/dist';
2+
import classNames from 'classnames';
3+
24
import { UnitSidebar } from '@src/course-unit/unit-sidebar/UnitSidebar';
5+
import { isUnitPageNewDesignEnabled } from '@src/course-unit/utils';
36

47
export const CourseAuthoringUnitSidebarSlot = (
58
{
@@ -12,7 +15,8 @@ export const CourseAuthoringUnitSidebarSlot = (
1215
isSplitTestType,
1316
}: CourseAuthoringUnitSidebarSlotProps,
1417
) => (
15-
<div className="pt-1" // This is to fix the vertical alignment of the sidebar
18+
<div
19+
className={classNames({ 'sidebar': isUnitPageNewDesignEnabled() })}
1620
>
1721
<PluginSlot
1822
id="org.openedx.frontend.authoring.course_unit_sidebar.v2"

0 commit comments

Comments
 (0)