This PR adds a plugin slot for the section list in the outline tab. This plugin can be used to add custom content before the list or add extra content to the titles for sections and subsections. To accomplish this, some of the smaller components inside Section and SequenceLink have been extrapolated into their own components so that they can be easily imported for use in plugins.
32 lines
832 B
TypeScript
32 lines
832 B
TypeScript
import React from 'react';
|
|
import { PluginSlot } from '@openedx/frontend-plugin-framework';
|
|
import Section from '@src/course-home/outline-tab/section-outline/Section';
|
|
|
|
interface Props {
|
|
expandAll: boolean;
|
|
sections: object;
|
|
sectionIds: string[];
|
|
}
|
|
|
|
const CourseHomeSectionOutlineSlot: React.FC<Props> = ({
|
|
expandAll, sections, sectionIds,
|
|
}) => (
|
|
<PluginSlot
|
|
id="course_home_section_outline_slot"
|
|
pluginProps={{ expandAll, sectionIds, sections }}
|
|
>
|
|
<ol id="courseHome-outline" className="list-unstyled">
|
|
{sectionIds.map((sectionId) => (
|
|
<Section
|
|
key={sectionId}
|
|
defaultOpen={sections[sectionId].resumeBlock}
|
|
expand={expandAll}
|
|
section={sections[sectionId]}
|
|
/>
|
|
))}
|
|
</ol>
|
|
</PluginSlot>
|
|
);
|
|
|
|
export default CourseHomeSectionOutlineSlot;
|