Introduces the ability to utilize SPA functionality when the relevant waffle flags are enabled for current MFE pages. When any new MFE page is loaded, a request is made to retrieve the waffle flags. This includes both global waffle flags related to MFE Authoring pages, as well as waffle flags specific to the current course.
45 lines
889 B
JavaScript
45 lines
889 B
JavaScript
import { Link } from 'react-router-dom';
|
|
import PropTypes from 'prop-types';
|
|
import { Hyperlink } from '@openedx/paragon';
|
|
|
|
const HelpSidebarLink = ({
|
|
as, pathToPage, title, isNewPage,
|
|
}) => {
|
|
const TagElement = as;
|
|
if (isNewPage) {
|
|
return (
|
|
<TagElement className="sidebar-link">
|
|
<Link to={pathToPage}>
|
|
{title}
|
|
</Link>
|
|
</TagElement>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<TagElement className="sidebar-link">
|
|
<Hyperlink
|
|
destination={pathToPage}
|
|
target="_blank"
|
|
showLaunchIcon={false}
|
|
>
|
|
{title}
|
|
</Hyperlink>
|
|
</TagElement>
|
|
);
|
|
};
|
|
|
|
HelpSidebarLink.propTypes = {
|
|
isNewPage: PropTypes.bool,
|
|
pathToPage: PropTypes.string.isRequired,
|
|
title: PropTypes.string.isRequired,
|
|
as: PropTypes.string,
|
|
};
|
|
|
|
HelpSidebarLink.defaultProps = {
|
|
as: 'li',
|
|
isNewPage: true,
|
|
};
|
|
|
|
export default HelpSidebarLink;
|