Skip to content

Commit 1fa9791

Browse files
feat: use frontend-plugin-framework to provide a FooterSlot
1 parent e314de2 commit 1fa9791

File tree

8 files changed

+117
-7
lines changed

8 files changed

+117
-7
lines changed

README.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ This MFE is bundled with `Devstack <https://github.com/openedx/devstack>`_, see
6363

6464
.. image:: ./docs/images/localhost_preview.png
6565

66+
Plugins
67+
=======
68+
This MFE can be customized using `Frontend Plugin Framework <https://github.com/openedx/frontend-plugin-framework>`_.
69+
70+
The parts of this MFE that can be customized in that manner are documented `here </src/plugin-slots>`_.
71+
6672
Environment Variables/Setup Notes
6773
=================================
6874

package-lock.json

Lines changed: 54 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
],
2929
"dependencies": {
3030
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
31-
"@edx/frontend-component-footer": "13.1.0",
31+
"@edx/frontend-component-footer": "^13.2.0",
3232
"@edx/frontend-component-header": "5.3.0",
3333
"@edx/frontend-platform": "8.0.1",
3434
"@edx/openedx-atlas": "^0.6.0",
@@ -37,6 +37,7 @@
3737
"@fortawesome/free-regular-svg-icons": "5.15.4",
3838
"@fortawesome/free-solid-svg-icons": "5.15.4",
3939
"@fortawesome/react-fontawesome": "0.2.0",
40+
"@openedx/frontend-plugin-framework": "^1.1.2",
4041
"@openedx/paragon": "22.0.0",
4142
"@tensorflow-models/blazeface": "0.0.7",
4243
"@tensorflow/tfjs-converter": "3.21.0",

src/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import ReactDOM from 'react-dom';
1111
import { Route, Routes, Outlet } from 'react-router-dom';
1212

1313
import Header from '@edx/frontend-component-header';
14-
import Footer from '@edx/frontend-component-footer';
14+
import { FooterSlot } from '@edx/frontend-component-footer';
1515

1616
import configureStore from './data/configureStore';
1717
import AccountSettingsPage, { NotFoundPage } from './account-settings';
@@ -34,7 +34,7 @@ subscribe(APP_READY, () => {
3434
<main className="flex-grow-1" id="main">
3535
<Outlet />
3636
</main>
37-
<Footer />
37+
<FooterSlot />
3838
</div>
3939
)}
4040
>
Lines changed: 50 additions & 0 deletions
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+
```
5.5 KB
Loading
6.17 KB
Loading

src/plugin-slots/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `frontend-app-account` Plugin Slots
2+
3+
* [`footer_slot`](./FooterSlot/)

0 commit comments

Comments
 (0)