Skip to content

Commit d747478

Browse files
brian-smith-tcrilarbrandes
authored andcommitted
feat: use frontend-plugin-framework to provide a FooterSlot
1 parent e1c78dd commit d747478

File tree

8 files changed

+7372
-4930
lines changed

8 files changed

+7372
-4930
lines changed

README.rst

+6
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ Cloning and Startup
5252

5353
The dev server is running at `http://localhost:2002 <http://localhost:2002>`_.
5454

55+
Plugins
56+
=======
57+
This MFE can be customized using `Frontend Plugin Framework <https://github.com/openedx/frontend-plugin-framework>`_.
58+
59+
The parts of this MFE that can be customized in that manner are documented `here </src/plugin-slots>`_.
60+
5561
Getting Help
5662
============
5763
Please tag **@openedx/edx-infinity ** on any PRs or issues. Thanks.

package-lock.json

+7,309-4,927
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@
3434
},
3535
"dependencies": {
3636
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
37-
"@edx/frontend-component-footer": "^13.0.2",
37+
"@edx/frontend-component-footer": "^13.2.0",
3838
"@edx/frontend-component-header": "^5.0.2",
3939
"@edx/frontend-platform": "^7.1.0",
4040
"@edx/openedx-atlas": "^0.6.0",
41+
"@openedx/frontend-plugin-framework": "^1.1.2",
4142
"@openedx/paragon": "^22.1.1",
4243
"@reduxjs/toolkit": "1.9.7",
4344
"@tinymce/tinymce-react": "3.13.1",

src/discussions/discussions-home/DiscussionsHome.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { selectPostEditorVisible } from '../posts/data/selectors';
2727
import { isCourseStatusValid } from '../utils';
2828
import useFeedbackWrapper from './FeedbackWrapper';
2929

30-
const Footer = lazy(() => import('@edx/frontend-component-footer'));
30+
const FooterSlot = lazy(() => import('@edx/frontend-component-footer').then(module => ({ default: module.FooterSlot })));
3131
const PostActionsBar = lazy(() => import('../posts/post-actions-bar/PostActionsBar'));
3232
const CourseTabsNavigation = lazy(() => import('../../components/NavigationBar/CourseTabsNavigation'));
3333
const LegacyBreadcrumbMenu = lazy(() => import('../navigation/breadcrumb-menu/LegacyBreadcrumbMenu'));
@@ -175,7 +175,7 @@ const DiscussionsHome = () => {
175175
)}
176176
{!enableInContextSidebar && isEnrolled && (<DiscussionsProductTour />)}
177177
</main>
178-
{!enableInContextSidebar && <Footer />}
178+
{!enableInContextSidebar && <FooterSlot />}
179179
</DiscussionContext.Provider>
180180
</Suspense>
181181
);

src/plugin-slots/FooterSlot/README.md

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Footer Slot
2+
3+
### Slot ID: `footer_slot`
4+
5+
## Description
6+
7+
This slot is used to replace/modify/hide the footer.
8+
9+
The implementation of the `FooterSlot` component lives in [the `frontend-component-footer` repository](https://github.com/openedx/frontend-component-footer/tree/master/src/components/footer-slot).
10+
11+
## Example
12+
13+
The following `env.config.jsx` will replace the default footer.
14+
15+
![Screenshot of Default Footer](./images/default_footer.png)
16+
17+
with a simple custom footer
18+
19+
![Screenshot of Custom Footer](./images/custom_footer.png)
20+
21+
```js
22+
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
23+
24+
const config = {
25+
pluginSlots: {
26+
footer_slot: {
27+
plugins: [
28+
{
29+
// Hide the default footer
30+
op: PLUGIN_OPERATIONS.Hide,
31+
widgetId: 'default_contents',
32+
},
33+
{
34+
// Insert a custom footer
35+
op: PLUGIN_OPERATIONS.Insert,
36+
widget: {
37+
id: 'custom_footer',
38+
type: DIRECT_PLUGIN,
39+
RenderWidget: () => (
40+
<h1 style={{textAlign: 'center'}}>🦶</h1>
41+
),
42+
},
43+
},
44+
]
45+
}
46+
},
47+
}
48+
49+
export default config;
50+
```
Loading
Loading

src/plugin-slots/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `frontend-app-discussions` Plugin Slots
2+
3+
* [`footer_slot`](./FooterSlot/)

0 commit comments

Comments
 (0)