Skip to content

Commit e8d49a0

Browse files
fix: sequence container width and responsive for sequence navigation block (#1218)
1 parent 21698b4 commit e8d49a0

File tree

6 files changed

+48
-25
lines changed

6 files changed

+48
-25
lines changed

src/courseware/course/sequence/Sequence.jsx

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -144,27 +144,29 @@ const Sequence = ({
144144
};
145145

146146
const defaultContent = (
147-
<div className="sequence-container d-inline-flex flex-row">
147+
<div className="sequence-container d-inline-flex flex-row w-100">
148148
<div className={classNames('sequence w-100', { 'position-relative': shouldDisplayNotificationTriggerInSequence })}>
149-
<SequenceNavigation
150-
sequenceId={sequenceId}
151-
unitId={unitId}
152-
className="mb-4"
153-
nextSequenceHandler={() => {
154-
logEvent('edx.ui.lms.sequence.next_selected', 'top');
155-
handleNext();
156-
}}
157-
onNavigate={(destinationUnitId) => {
158-
logEvent('edx.ui.lms.sequence.tab_selected', 'top', destinationUnitId);
159-
handleNavigate(destinationUnitId);
160-
}}
161-
previousSequenceHandler={() => {
162-
logEvent('edx.ui.lms.sequence.previous_selected', 'top');
163-
handlePrevious();
164-
}}
165-
goToCourseExitPage={() => goToCourseExitPage()}
166-
/>
167-
{shouldDisplayNotificationTriggerInSequence && <SidebarTriggers />}
149+
<div className="sequence-navigation-container">
150+
<SequenceNavigation
151+
sequenceId={sequenceId}
152+
unitId={unitId}
153+
className="mb-4"
154+
nextSequenceHandler={() => {
155+
logEvent('edx.ui.lms.sequence.next_selected', 'top');
156+
handleNext();
157+
}}
158+
onNavigate={(destinationUnitId) => {
159+
logEvent('edx.ui.lms.sequence.tab_selected', 'top', destinationUnitId);
160+
handleNavigate(destinationUnitId);
161+
}}
162+
previousSequenceHandler={() => {
163+
logEvent('edx.ui.lms.sequence.previous_selected', 'top');
164+
handlePrevious();
165+
}}
166+
goToCourseExitPage={() => goToCourseExitPage()}
167+
/>
168+
{shouldDisplayNotificationTriggerInSequence && <SidebarTriggers />}
169+
</div>
168170

169171
<div className="unit-container flex-grow-1">
170172
<SequenceContent

src/courseware/course/sequence/sequence-navigation/SequenceNavigation.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const SequenceNavigation = ({
8080
const prevArrow = isRtl(getLocale()) ? ChevronRight : ChevronLeft;
8181

8282
return sequenceStatus === LOADED && (
83-
<nav id="courseware-sequenceNavigation" className={classNames('sequence-navigation', className)} style={{ width: shouldDisplayNotificationTriggerInSequence ? '90%' : null }}>
83+
<nav id="courseware-sequenceNavigation" className={classNames('sequence-navigation', className, { 'mr-2': shouldDisplayNotificationTriggerInSequence })}>
8484
<Button variant="link" className="previous-btn" onClick={previousSequenceHandler} disabled={isFirstUnit} iconBefore={prevArrow}>
8585
{shouldDisplayNotificationTriggerInSequence ? null : intl.formatMessage(messages.previousButton)}
8686
</Button>

src/courseware/course/sidebar/SidebarTriggers.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import classNames from 'classnames';
22
import React, { useContext } from 'react';
3+
import { breakpoints, useWindowSize } from '@edx/paragon';
34
import SidebarContext from './SidebarContext';
45
import { SIDEBAR_ORDER, SIDEBARS } from './sidebars';
56

@@ -8,14 +9,17 @@ const SidebarTriggers = () => {
89
toggleSidebar,
910
currentSidebar,
1011
} = useContext(SidebarContext);
12+
13+
const isMobileView = useWindowSize().width < breakpoints.small.minWidth;
14+
1115
return (
1216
<div className="d-flex ml-auto">
1317
{SIDEBAR_ORDER.map((sidebarId) => {
1418
const { Trigger } = SIDEBARS[sidebarId];
1519
const isActive = sidebarId === currentSidebar;
1620
return (
1721
<div
18-
className={classNames('mt-3', { 'border-primary-700': isActive })}
22+
className={classNames({ 'mt-3': !isMobileView, 'border-primary-700': isActive })}
1923
style={{ borderBottom: isActive ? '2px solid' : null }}
2024
key={sidebarId}
2125
>

src/courseware/course/sidebar/common/TriggerBase.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const SidebarTriggerBase = ({
88
children,
99
}) => (
1010
<button
11-
className="border border-light-400 bg-transparent align-items-center align-content-center d-flex"
11+
className="border border-light-400 bg-transparent align-items-center align-content-center d-flex notification-btn"
1212
type="button"
1313
onClick={onClick}
1414
aria-label={ariaLabel}

src/generic/tabs/useIndexOfLastVisibleChild.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const invisibleStyle = {
66
left: 0,
77
pointerEvents: 'none',
88
visibility: 'hidden',
9+
maxWidth: '100%',
910
};
1011

1112
/**

src/index.scss

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@
9090
// On mobile, the unit container will be responsible
9191
// for container padding.
9292
@media (min-width: map-get($grid-breakpoints, "sm")) {
93-
width: 100%;
9493
margin-right: auto;
9594
margin-left: auto;
9695
}
@@ -103,8 +102,24 @@
103102
}
104103
}
105104

105+
.sequence-navigation-container {
106+
display: flex;
107+
align-items: flex-start;
108+
}
109+
110+
.notification-btn {
111+
@media (max-width: -1 + map-get($grid-breakpoints, "sm")) {
112+
height: 3rem;
113+
}
114+
}
115+
106116
.sequence-navigation {
107117
display: flex;
118+
flex-grow: 1;
119+
120+
@media (max-width: -1 + map-get($grid-breakpoints, "sm")) {
121+
max-width: 100%;
122+
}
108123

109124
@media (min-width: map-get($grid-breakpoints, "sm")) {
110125
margin: -1px -1px 0;
@@ -172,9 +187,10 @@
172187
}
173188

174189
.sequence-navigation-tabs {
190+
overflow: auto;
175191
.btn {
176192
flex-basis: 100%;
177-
min-width: 2rem;
193+
min-width: 3rem;
178194
}
179195
}
180196

0 commit comments

Comments
 (0)