Skip to content

Commit 7432a4e

Browse files
feat: update UnitTitleSlot to wrap unit title
1 parent c7a81fe commit 7432a4e

4 files changed

Lines changed: 13 additions & 6 deletions

File tree

src/courseware/course/sequence/Unit/index.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ const Unit = ({
4242
return (
4343
<div className="unit">
4444
<div className="mb-0">
45-
<h3 className="h3">{unit.title}</h3>
46-
<UnitTitleSlot courseId={courseId} unitId={id} unitTitle={unit.title} />
45+
<UnitTitleSlot courseId={courseId} unitId={id} unitTitle={unit.title}>
46+
<h3 className="h3">{unit.title}</h3>
47+
</UnitTitleSlot>
4748
</div>
4849
<h2 className="sr-only">{formatMessage(messages.headerPlaceholder)}</h2>
4950
<BookmarkButton

src/plugin-slots/UnitTitleSlot/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
## Description
1010

11-
This slot is used for adding content after the Unit title.
11+
This slot is used for adding content around the Unit title.
1212

1313
## Example
1414

@@ -22,6 +22,7 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame
2222
const config = {
2323
pluginSlots: {
2424
unit_title_slot: {
25+
keepDefault: true,
2526
plugins: [
2627
{
2728
// Insert custom content after unit title
@@ -33,7 +34,7 @@ const config = {
3334
<>
3435
<p>📚: {courseId}</p>
3536
<p>📙: {unitId}</p>
36-
<p>📙: {unitTitle}</p>
37+
<p>🎩: {unitTitle}</p>
3738
</>
3839
),
3940
},
47.3 KB
Loading
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
import PropTypes from 'prop-types';
22
import { PluginSlot } from '@openedx/frontend-plugin-framework';
33

4-
const UnitTitleSlot = ({ courseId, unitId, unitTitle }) => (
4+
const UnitTitleSlot = ({
5+
courseId, unitId, unitTitle, children,
6+
}) => (
57
<PluginSlot
68
id="unit_title_slot"
79
pluginProps={{
810
courseId,
911
unitId,
1012
unitTitle,
1113
}}
12-
/>
14+
>
15+
{children}
16+
</PluginSlot>
1317
);
1418

1519
UnitTitleSlot.propTypes = {
1620
courseId: PropTypes.string.isRequired,
1721
unitId: PropTypes.string.isRequired,
1822
unitTitle: PropTypes.string.isRequired,
23+
children: PropTypes.element.isRequired,
1924
};
2025

2126
export default UnitTitleSlot;

0 commit comments

Comments
 (0)