diff --git a/src/courseware/course/new-sidebar/sidebars/discussions-notifications/DiscussionsNotificationsSidebar.jsx b/src/courseware/course/new-sidebar/sidebars/discussions-notifications/DiscussionsNotificationsSidebar.jsx index eabd7492e8..b8b5e4211d 100644 --- a/src/courseware/course/new-sidebar/sidebars/discussions-notifications/DiscussionsNotificationsSidebar.jsx +++ b/src/courseware/course/new-sidebar/sidebars/discussions-notifications/DiscussionsNotificationsSidebar.jsx @@ -14,19 +14,19 @@ const DiscussionsNotificationsSidebar = () => { const { hideNotificationbar } = useContext(SidebarContext); return ( -
- + +
{!hideNotificationbar &&
} - -
+
+
); }; diff --git a/src/courseware/course/sequence/sequence-navigation/SequenceNavigationTabs.jsx b/src/courseware/course/sequence/sequence-navigation/SequenceNavigationTabs.jsx index 0160eb90c3..7304de5401 100644 --- a/src/courseware/course/sequence/sequence-navigation/SequenceNavigationTabs.jsx +++ b/src/courseware/course/sequence/sequence-navigation/SequenceNavigationTabs.jsx @@ -5,7 +5,9 @@ import classNames from 'classnames'; import UnitButton from './UnitButton'; import SequenceNavigationDropdown from './SequenceNavigationDropdown'; import useIndexOfLastVisibleChild from '../../../../generic/tabs/useIndexOfLastVisibleChild'; -import { useIsOnXLDesktop, useIsSidebarOpen } from './hooks'; +import { + useIsOnXLDesktop, useIsOnMediumDesktop, useIsOnLargeDesktop, useIsSidebarOpen, +} from './hooks'; const SequenceNavigationTabs = ({ unitIds, unitId, showCompletion, onNavigate, @@ -15,21 +17,28 @@ const SequenceNavigationTabs = ({ indexOfLastVisibleChild, containerRef, invisibleStyle, - ] = useIndexOfLastVisibleChild(); + ] = useIndexOfLastVisibleChild(isSidebarOpen); const isOnXLDesktop = useIsOnXLDesktop(); - const shouldDisplayDropdown = indexOfLastVisibleChild === -1; + const isOnLargeDesktop = useIsOnLargeDesktop(); + const isOnMediumDesktop = useIsOnMediumDesktop(); + const shouldDisplayDropdown = indexOfLastVisibleChild === -1 || indexOfLastVisibleChild < unitIds.length - 1; return ( -
+
{unitIds.map(buttonUnitId => ( = breakpoints.medium.minWidth && windowSize.width < breakpoints.extraLarge.minWidth; +} + +export function useIsOnLargeDesktop() { + const windowSize = useWindowSize(); + return windowSize.width >= breakpoints.extraLarge.minWidth && windowSize.width < breakpoints.extraLarge.maxWidth; +} + export function useIsOnXLDesktop() { const windowSize = useWindowSize(); - return windowSize.width >= breakpoints.extraLarge.minWidth; + return windowSize.width >= breakpoints.extraLarge.maxWidth; } export function useIsSidebarOpen(unitId) { @@ -84,6 +94,6 @@ export function useIsSidebarOpen(unitId) { const { currentSidebar } = useContext(isNewDiscussionSidebarViewEnabled ? NewSidebarContext : SidebarContext); const topic = useModel('discussionTopics', unitId); - return (currentSidebar === WIDGETS.NOTIFICATIONS) || ( + return (currentSidebar === WIDGETS.NOTIFICATIONS) || (currentSidebar === 'DISCUSSIONS_NOTIFICATIONS') || ( currentSidebar === WIDGETS.DISCUSSIONS && !!(topic?.id || topic?.enabledInContext)); } diff --git a/src/generic/tabs/useIndexOfLastVisibleChild.js b/src/generic/tabs/useIndexOfLastVisibleChild.js index bed3e57928..603076d4a8 100644 --- a/src/generic/tabs/useIndexOfLastVisibleChild.js +++ b/src/generic/tabs/useIndexOfLastVisibleChild.js @@ -30,7 +30,7 @@ const invisibleStyle = { * included when determining which children will fit or not. Usage of this ref * is optional. */ -export default function useIndexOfLastVisibleChild() { +export default function useIndexOfLastVisibleChild(isSidebarOpen) { const containerElementRef = useRef(null); const overflowElementRef = useRef(null); const containingRectRef = useRef({}); @@ -72,7 +72,7 @@ export default function useIndexOfLastVisibleChild() { setIndexOfLastVisibleChild(nextIndexOfLastVisibleChild); // eslint-disable-next-line react-hooks/exhaustive-deps - }, [windowSize, containerElementRef.current]); + }, [windowSize, containerElementRef.current, isSidebarOpen]); return [indexOfLastVisibleChild, containerElementRef, invisibleStyle, overflowElementRef]; } diff --git a/src/index.scss b/src/index.scss index 49886987f2..b059dea420 100755 --- a/src/index.scss +++ b/src/index.scss @@ -173,8 +173,16 @@ } } - .navigation-tab-width { - max-width: 46rem; + .navigation-tab-width-xl { + max-width: 47rem; + } + + .navigation-tab-width-large { + max-width: 28rem; + } + + .navigation-tab-width-medium{ + max-width: 23.5rem; } .sequence-navigation-dropdown {