@@ -84,16 +131,15 @@ exports[`CourseList snapshots with no filters 1`] = `
className="course-list-container"
>
My Courses
diff --git a/src/containers/CourseList/hooks.js b/src/containers/CourseList/hooks.js
index 1fb1a73..ebbe74b 100644
--- a/src/containers/CourseList/hooks.js
+++ b/src/containers/CourseList/hooks.js
@@ -1,7 +1,7 @@
import React from 'react';
import { useDispatch } from 'react-redux';
-import { useCheckboxSetValues } from '@edx/paragon';
+import { useCheckboxSetValues, useWindowSize, breakpoints } from '@edx/paragon';
import { StrictDict } from 'utils';
import { actions, hooks as appHooks } from 'data/redux';
@@ -9,6 +9,11 @@ import { ListPageSize, SortKeys } from 'data/constants/app';
import * as module from './hooks';
+export const useIsCollapsed = () => {
+ const { width } = useWindowSize();
+ return width < breakpoints.medium.maxWidth;
+};
+
export const state = StrictDict({
sortBy: (val) => React.useState(val), // eslint-disable-line
});
diff --git a/src/containers/CourseList/index.jsx b/src/containers/CourseList/index.jsx
index 1760a60..a5d357f 100644
--- a/src/containers/CourseList/index.jsx
+++ b/src/containers/CourseList/index.jsx
@@ -9,7 +9,7 @@ import {
} from 'containers/CourseFilterControls';
import CourseCard from 'containers/CourseCard';
-import { useCourseListData } from './hooks';
+import { useCourseListData, useIsCollapsed } from './hooks';
import messages from './messages';
@@ -24,11 +24,12 @@ export const CourseList = () => {
showFilters,
visibleList,
} = useCourseListData();
+ const isCollapsed = useIsCollapsed();
return (
-
-
{formatMessage(messages.myCourses)}
-
+
+
{formatMessage(messages.myCourses)}
+
@@ -43,7 +44,7 @@ export const CourseList = () => {
))}
{numPages > 1 && (
({
useCourseListData: jest.fn(),
+ useIsCollapsed: jest.fn(),
}));
jest.mock('containers/CourseCard', () => 'CourseCard');
@@ -21,6 +22,7 @@ describe('CourseList', () => {
showFilters: false,
visibleList: [],
};
+ useIsCollapsed.mockReturnValue(false);
const createWrapper = (courseListData) => {
useCourseListData.mockReturnValueOnce({
...defaultCourseListData,
@@ -50,5 +52,14 @@ describe('CourseList', () => {
});
expect(wrapper).toMatchSnapshot();
});
+ test('collapsed with multiple courses and pages', () => {
+ useIsCollapsed.mockReturnValueOnce(true);
+ const wrapper = createWrapper({
+ visibleList: [{ cardId: 'foo' }, { cardId: 'bar' }, { cardId: 'baz' }],
+ numPages: 3,
+ showFilters: true,
+ });
+ expect(wrapper).toMatchSnapshot();
+ });
});
});
diff --git a/src/containers/Dashboard/LoadedView.jsx b/src/containers/Dashboard/LoadedView.jsx
index d3e0b996c..3663dae 100644
--- a/src/containers/Dashboard/LoadedView.jsx
+++ b/src/containers/Dashboard/LoadedView.jsx
@@ -7,13 +7,17 @@ import hooks from './hooks';
export const columnConfig = {
courseList: {
- xs: { span: 12, offset: 0 },
- sm: { span: 8, offset: 2 },
- md: { span: 12, offset: 0 },
- lg: { span: 10, offset: 1 },
+ sm: { span: 12, offset: 0 },
+ md: { span: 10, offset: 1 },
+ lg: { span: 12, offset: 0 },
xl: { span: 8, offset: 0 },
},
- sidebar: { md: 12, xl: 4 },
+ sidebar: {
+ sm: { span: 12, offset: 0 },
+ md: { span: 10, offset: 1 },
+ lg: { span: 12, offset: 0 },
+ xl: { span: 4, offset: 0 },
+ },
};
export const LoadedView = () => {
@@ -22,11 +26,11 @@ export const LoadedView = () => {
return (
-
+
-
- {!isCollapsed && (
)}
+
+ {!isCollapsed && (
)}
diff --git a/src/containers/Dashboard/__snapshots__/LoadedView.test.jsx.snap b/src/containers/Dashboard/__snapshots__/LoadedView.test.jsx.snap
index bb4efbd..df69a87 100644
--- a/src/containers/Dashboard/__snapshots__/LoadedView.test.jsx.snap
+++ b/src/containers/Dashboard/__snapshots__/LoadedView.test.jsx.snap
@@ -7,23 +7,23 @@ exports[`LoadedView collapsed snapshot 1`] = `
>
+
+
+
-
-
-
@@ -59,23 +75,23 @@ exports[`LoadedView not collapsed snapshot 1`] = `
>
+
+
+
-
-
-
diff --git a/src/containers/Dashboard/index.scss b/src/containers/Dashboard/index.scss
index e69de29..3241781 100644
--- a/src/containers/Dashboard/index.scss
+++ b/src/containers/Dashboard/index.scss
@@ -0,0 +1,22 @@
+@import "@edx/paragon/scss/core/core";
+
+.course-list-column {
+ padding: 0 map-get($spacers, 4);
+ margin: auto;
+}
+
+.sidebar-column {
+ padding: 0 map-get($spacers, 3) 0 map-get($spacers, 1);
+}
+
+@include media-breakpoint-down(lg) {
+ .sidebar-column {
+ // grid are inheriting dir="ltr" from the body, so we need to override it
+ [dir=ltr] & {
+ padding: 0 map-get($spacers, 3);
+ }
+ [dir=rtl] & {
+ padding: 0 map-get($spacers, 3);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/containers/LearnerDashboardHeader/__snapshots__/index.test.jsx.snap b/src/containers/LearnerDashboardHeader/__snapshots__/index.test.jsx.snap
index 92abd92..6fee45f 100644
--- a/src/containers/LearnerDashboardHeader/__snapshots__/index.test.jsx.snap
+++ b/src/containers/LearnerDashboardHeader/__snapshots__/index.test.jsx.snap
@@ -36,9 +36,6 @@ exports[`LearnerDashboardHeader snapshots with collapsed 1`] = `
-
`;
@@ -77,8 +74,5 @@ exports[`LearnerDashboardHeader snapshots without collapsed 1`] = `
/>
-
`;
diff --git a/src/containers/LearnerDashboardHeader/index.jsx b/src/containers/LearnerDashboardHeader/index.jsx
index e17702d..c7d2273 100644
--- a/src/containers/LearnerDashboardHeader/index.jsx
+++ b/src/containers/LearnerDashboardHeader/index.jsx
@@ -53,7 +53,6 @@ export const LearnerDashboardHeader = () => {
{!isCollapsed &&
}
-
>
);
};
diff --git a/src/containers/MasqueradeBar/__snapshots__/index.test.jsx.snap b/src/containers/MasqueradeBar/__snapshots__/index.test.jsx.snap
index 224435c..42af13c 100644
--- a/src/containers/MasqueradeBar/__snapshots__/index.test.jsx.snap
+++ b/src/containers/MasqueradeBar/__snapshots__/index.test.jsx.snap
@@ -1,178 +1,202 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`MasqueradeBar snapshot can masquerade 1`] = `
-
+ state="default"
+ type="submit"
+ variant="brand"
+ />
+
+
+ state="default"
+ type="submit"
+ variant="brand"
+ />
+
+