38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
import React, { useCallback } from 'react';
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
import { faLock } from '@fortawesome/free-solid-svg-icons';
|
|
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
|
import { history } from '@edx/frontend-platform';
|
|
import { Button } from '@edx/paragon';
|
|
|
|
import messages from './messages';
|
|
|
|
function ContentLock({
|
|
intl, courseUsageKey, prereqSectionName, prereqId, sectionName,
|
|
}) {
|
|
const handleClick = useCallback(() => {
|
|
history.push(`/course/${courseUsageKey}/${prereqId}`);
|
|
});
|
|
|
|
return (
|
|
<>
|
|
<h3>
|
|
<FontAwesomeIcon icon={faLock} />{' '}
|
|
{sectionName}
|
|
</h3>
|
|
<h4>{intl.formatMessage(messages['learn.contentLock.content.locked'])}</h4>
|
|
<p>{intl.formatMessage(messages['learn.contentLock.complete.prerequisite'], {
|
|
prereqSectionName,
|
|
})}
|
|
</p>
|
|
<p>
|
|
<Button className="btn-primary" onClick={handleClick}>{intl.formatMessage(messages['learn.contentLock.goToSection'])}</Button>
|
|
</p>
|
|
</>
|
|
);
|
|
}
|
|
ContentLock.propTypes = {
|
|
intl: intlShape.isRequired,
|
|
};
|
|
export default injectIntl(ContentLock);
|