-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1104c58
commit 9228d01
Showing
6 changed files
with
74 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Course Card Action Slot | ||
|
||
### Slot ID: `course_banner_slot` | ||
### Props: | ||
* `cardId` | ||
|
||
## Description | ||
|
||
This slot is used for replacing or adding content for the `CourseBanner` component. This banner is rendered as a child of the `CourseCard`. | ||
|
||
The default CourseBanner looks like this when audit access has expired for the course: | ||
 | ||
|
||
## Example | ||
|
||
The following `env.config.jsx` will render a custom implemenation of a CourseBanner under every `CourseCard`. | ||
|
||
 | ||
|
||
```js | ||
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework'; | ||
|
||
const config = { | ||
pluginSlots: { | ||
course_banner_slot: { | ||
keepDefault: false, | ||
plugins: [ | ||
{ | ||
op: PLUGIN_OPERATIONS.Insert, | ||
widget: { | ||
id: 'custom_course_banner', | ||
type: DIRECT_PLUGIN, | ||
priority: 60, | ||
RenderWidget: ({ cardId }) => ( | ||
<Alert variant="info" className="mb-0"> | ||
Course banner for course with {cardId} | ||
</Alert> | ||
), | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
} | ||
|
||
export default config; | ||
``` |
Binary file added
BIN
+90.4 KB
src/plugin-slots/CourseBannerSlot/images/course_banner_slot_default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { PluginSlot } from '@openedx/frontend-plugin-framework'; | ||
import CourseBanner from 'containers/CourseCard/components/CourseCardBanners/CourseBanner'; | ||
|
||
const CourseBannerSlot = ({ cardId }) => ( | ||
<PluginSlot | ||
id="course_banner_slot" | ||
pluginProps={{ | ||
cardId, | ||
}} | ||
> | ||
<CourseBanner | ||
cardId={cardId} | ||
/> | ||
</PluginSlot> | ||
); | ||
|
||
CourseBannerSlot.propTypes = { | ||
cardId: PropTypes.string.isRequired, | ||
}; | ||
|
||
export default CourseBannerSlot; |