Removes the tightly coupled upgrade/upsell ("notifications") panel from the Learning MFE core and replaces it with a pluggable widget registry system. The right sidebar now supports dynamically-registered external widgets, making it easy to add, remove, or replace sidebar panels without forking the MFE.
20 lines
395 B
JavaScript
20 lines
395 B
JavaScript
import { useContext } from 'react';
|
|
|
|
import SidebarContext from './SidebarContext';
|
|
|
|
const Sidebar = () => {
|
|
const { currentSidebar, SIDEBARS } = useContext(SidebarContext);
|
|
|
|
if (!currentSidebar || !SIDEBARS || !SIDEBARS[currentSidebar]) {
|
|
return null;
|
|
}
|
|
|
|
const SidebarToRender = SIDEBARS[currentSidebar].Sidebar;
|
|
|
|
return (
|
|
<SidebarToRender />
|
|
);
|
|
};
|
|
|
|
export default Sidebar;
|