Skip to content

Commit

Permalink
feat: ora mobile responsive
Browse files Browse the repository at this point in the history
  • Loading branch information
vladislavkeblysh committed Jun 12, 2024
1 parent c644da3 commit 3bdc24a
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exports[`Info Popover Component snapshot 1`] = `
</Popover.Content>
</Popover>
}
placement="right-end"
placement="left-end"
trigger="focus"
>
<IconButton
Expand Down
2 changes: 1 addition & 1 deletion src/components/InfoPopover/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import messages from './messages';
export const InfoPopover = ({ onClick, children, intl }) => (
<OverlayTrigger
trigger="focus"
placement="right-end"
placement="left-end"
flip
overlay={(
<Popover id="info-popover" className="overlay-help-popover">
Expand Down
10 changes: 10 additions & 0 deletions src/containers/ListView/ListView.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,14 @@ span.pgn__icon.breadcrumb-arrow {
margin-bottom: 0;
}
}

@include media-breakpoint-down(xs) {
.badge {
white-space: normal;
}

.pgn__table-actions > div:first-of-type {
z-index: $zindex-modal !important;
}
}
}
8 changes: 7 additions & 1 deletion src/containers/ReviewActions/ReviewActions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@
.review-actions-username {
padding-bottom: map-get($spacers, 3);
}
}
}

@include media-breakpoint-down(xs) {
.overlay-help-popover {
max-width: calc(100% - 60px) !important;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exports[`ReviewActions component component snapshot: do not show rubric 1`] = `
status="grading-status"
/>
<span
className="small"
className="small text-nowrap"
>
<FormattedMessage
defaultMessage="Score: {pointsEarned}/{pointsPossible}"
Expand Down Expand Up @@ -71,7 +71,7 @@ exports[`ReviewActions component component snapshot: loading 1`] = `
status="grading-status"
/>
<span
className="small"
className="small text-nowrap"
>
<FormattedMessage
defaultMessage="Score: {pointsEarned}/{pointsPossible}"
Expand Down Expand Up @@ -113,7 +113,7 @@ exports[`ReviewActions component component snapshot: show rubric, no score 1`] =
status="grading-status"
/>
<span
className="small"
className="small text-nowrap"
/>
</span>
<div
Expand Down
2 changes: 1 addition & 1 deletion src/containers/ReviewActions/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const ReviewActions = ({
{ gradingStatus && (
<StatusBadge className="review-actions-status mr-3" status={gradingStatus} />
)}
<span className="small">
<span className="small text-nowrap">
{pointsPossible && (
<FormattedMessage
{...messages.pointsDisplay}
Expand Down
21 changes: 21 additions & 0 deletions src/containers/ReviewModal/__snapshots__/index.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,24 @@

exports[`ReviewModal component component snapshots closed 1`] = `
<FullscreenModal
afterBodyNode={null}
beforeBodyNode={
<React.Fragment>
<ReviewActions />
<DemoWarning />
</React.Fragment>
}
className="review-modal"
closeLabel="Close"
footerNode={null}
hasCloseButton={true}
isFullscreenScroll={false}
isOpen={false}
modalBodyClassName="review-modal-body"
onClose={[MockFunction hooks.onClose]}
size="fullscreen"
title="test-ora-name"
variant="dark"
>
<CloseReviewConfirmModal
prop="hooks.closeConfirmModalProps"
Expand All @@ -22,17 +29,24 @@ exports[`ReviewModal component component snapshots closed 1`] = `

exports[`ReviewModal component component snapshots loading 1`] = `
<FullscreenModal
afterBodyNode={null}
beforeBodyNode={
<React.Fragment>
<ReviewActions />
<DemoWarning />
</React.Fragment>
}
className="review-modal"
closeLabel="Close"
footerNode={null}
hasCloseButton={true}
isFullscreenScroll={false}
isOpen={true}
modalBodyClassName="review-modal-body"
onClose={[MockFunction hooks.onClose]}
size="fullscreen"
title="test-ora-name"
variant="dark"
>
<ReviewContent />
<LoadingMessage
Expand All @@ -52,17 +66,24 @@ exports[`ReviewModal component component snapshots loading 1`] = `

exports[`ReviewModal component component snapshots success 1`] = `
<FullscreenModal
afterBodyNode={null}
beforeBodyNode={
<React.Fragment>
<ReviewActions />
<DemoWarning />
</React.Fragment>
}
className="review-modal"
closeLabel="Close"
footerNode={null}
hasCloseButton={true}
isFullscreenScroll={false}
isOpen={true}
modalBodyClassName="review-modal-body"
onClose={[MockFunction hooks.onClose]}
size="fullscreen"
title="test-ora-name"
variant="dark"
>
<ReviewContent />
<CloseReviewConfirmModal
Expand Down
7 changes: 5 additions & 2 deletions src/containers/ReviewModal/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { useDispatch } from 'react-redux';

import { FullscreenModal } from '@edx/paragon';
import { FullscreenModal, Truncate, useMediaQuery } from '@edx/paragon';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';

import LoadingMessage from 'components/LoadingMessage';
Expand All @@ -27,9 +27,12 @@ export const ReviewModal = ({ intl }) => {
isOpen,
closeConfirmModalProps,
} = hooks.rendererHooks({ dispatch, intl });

const isMobile = useMediaQuery({ query: '(max-width: 575.98px)' });

return (
<FullscreenModal
title={title}
title={isMobile ? <Truncate lines={3}>{title}</Truncate> : title}
isOpen={isOpen}
beforeBodyNode={(
<>
Expand Down
5 changes: 5 additions & 0 deletions src/containers/ReviewModal/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ jest.mock('./hooks', () => ({
rendererHooks: jest.fn(),
}));

jest.mock('@edx/paragon', () => ({
...jest.requireActual('@edx/paragon'),
useMediaQuery: jest.fn(),
}));

const dispatch = useDispatch();

describe('ReviewModal component', () => {
Expand Down

0 comments on commit 3bdc24a

Please sign in to comment.