Skip to content

Commit

Permalink
feat: update components to be compatible with paragon alpha 22
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoa committed Jan 10, 2024
1 parent e2ba574 commit 30c8554
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 37 deletions.
7 changes: 4 additions & 3 deletions src/course-home/outline-tab/Section.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { Collapsible, IconButton } from '@edx/paragon';
import { faCheckCircle as fasCheckCircle, faMinus, faPlus } from '@fortawesome/free-solid-svg-icons';
import { faCheckCircle as fasCheckCircle } from '@fortawesome/free-solid-svg-icons';
import { faCheckCircle as farCheckCircle } from '@fortawesome/free-regular-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Add, Minus } from '@edx/paragon/icons';

import SequenceLink from './SequenceLink';
import { useModel } from '../../generic/model-store';
Expand Down Expand Up @@ -81,15 +82,15 @@ function Section({
iconWhenClosed={(
<IconButton
alt={intl.formatMessage(messages.openSection)}
icon={faPlus}
iconAs={Add}
onClick={() => { setOpen(true); }}
size="sm"
/>
)}
iconWhenOpen={(
<IconButton
alt={intl.formatMessage(genericMessages.close)}
icon={faMinus}
iconAs={Minus}
onClick={() => { setOpen(false); }}
size="sm"
/>
Expand Down
4 changes: 2 additions & 2 deletions src/courseware/course/CourseBreadcrumbs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function CourseBreadcrumb({
whiteSpace: 'nowrap',
}}
>
{ getConfig().ENABLE_JUMPNAV !== 'true' || content.length < 2 || !isStaff
{getConfig().ENABLE_JUMPNAV !== 'true' || content.length < 2 || !isStaff
? (
<Link
className="text-primary-500"
Expand All @@ -40,7 +40,7 @@ function CourseBreadcrumb({
</Link>
)
: (
<SelectMenu isLink defaultMessage={defaultContent.label}>
<SelectMenu variant="link" defaultMessage={defaultContent.label}>
{content.map(item => (
<JumpNavMenuItem
isDefault={item.default}
Expand Down
54 changes: 25 additions & 29 deletions src/courseware/course/sequence/Unit.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getConfig } from '@edx/frontend-platform';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { AppContext, ErrorPage } from '@edx/frontend-platform/react';
import { Modal } from '@edx/paragon';
import { ModalDialog } from '@edx/paragon';
import PropTypes from 'prop-types';
import React, {
Suspense, useCallback, useContext, useEffect, useLayoutEffect, useState,
Expand Down Expand Up @@ -164,7 +164,7 @@ function Unit({
isBookmarked={unit.bookmarked}
isProcessing={unit.bookmarkedUpdateState === 'loading'}
/>
{ !mmp2p.state.isEnabled && contentTypeGatingEnabled && unit.containsContentTypeGatedContent && (
{!mmp2p.state.isEnabled && contentTypeGatingEnabled && unit.containsContentTypeGatedContent && (
<Suspense
fallback={(
<PageLoading
Expand All @@ -175,8 +175,8 @@ function Unit({
<LockPaywall courseId={courseId} />
</Suspense>
)}
{ /** [MM-P2P] Experiment */ }
{ mmp2p.meta.showLock && (
{ /** [MM-P2P] Experiment */}
{mmp2p.meta.showLock && (
<MMP2PLockPaywall options={mmp2p} />
)}
{!mmp2p.meta.blockContent && shouldDisplayHonorCode && (
Expand All @@ -190,7 +190,7 @@ function Unit({
<HonorCode courseId={courseId} />
</Suspense>
)}
{ /** [MM-P2P] Experiment (conditional) */ }
{ /** [MM-P2P] Experiment (conditional) */}
{!mmp2p.meta.blockContent && !shouldDisplayHonorCode && !hasLoaded && !showError && (
<PageLoading
srMessage={intl.formatMessage(messages.loadingSequence)}
Expand All @@ -200,32 +200,28 @@ function Unit({
<ErrorPage />
)}
{modalOptions.open && (
<Modal
body={(
<>
{modalOptions.body
? <div className="unit-modal">{ modalOptions.body }</div>
: (
<iframe
title={modalOptions.title}
allow={IFRAME_FEATURE_POLICY}
frameBorder="0"
src={modalOptions.url}
style={{
width: '100%',
height: '100vh',
}}
/>
)}
</>
)}
<ModalDialog
className="modal-lti"
onClose={() => { setModalOptions({ open: false }); }}
open
dialogClassName="modal-lti"
/>
isOpen
>
<ModalDialog.Body className="modal-lti">
{modalOptions.body
? <div className="unit-modal">{modalOptions.body}</div>
: (
<iframe
title={modalOptions.title}
allow={IFRAME_FEATURE_POLICY}
frameBorder="0"
src={modalOptions.url}
style={{ width: '100%', height: '100vh' }}
/>
)}
</ModalDialog.Body>
</ModalDialog>
)}
{ /** [MM-P2P] Experiment (conditional) */ }
{ !mmp2p.meta.blockContent && !shouldDisplayHonorCode && (
{ /** [MM-P2P] Experiment (conditional) */}
{!mmp2p.meta.blockContent && !shouldDisplayHonorCode && (
<div className="unit-iframe-wrapper">
<iframe
id="unit-iframe"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, {
} from 'react';
import PropTypes from 'prop-types';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { Input } from '@edx/paragon';
import { Form } from '@edx/paragon';

import messages from './messages';

Expand Down Expand Up @@ -46,7 +46,7 @@ class MasqueradeUserNameInput extends Component {
...rest
} = this.props;
return (
<Input
<Form.Control
aria-labelledby="masquerade-search-label"
label={intl.formatMessage(messages.userNameLabel)}
onKeyPress={(event) => this.onKeyPress(event)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class MasqueradeWidget extends Component {
<span className="col-auto col-form-label pl-3" id="masquerade-search-label">{`${specificLearnerInputText}:`}</span>
<MasqueradeUserNameInput
id="masquerade-search"
className="col-4 form-control"
className="col-4"
autoFocus={autoFocus}
defaultValue={masqueradeUsername}
onError={(errorMessage) => this.onError(errorMessage)}
Expand Down

0 comments on commit 30c8554

Please sign in to comment.