Skip to content

Commit 9ef81f7

Browse files
feat: use frontend-plugin-framework to provide a FooterSlot (#1017)
1 parent 6a32790 commit 9ef81f7

File tree

8 files changed

+145
-6
lines changed

8 files changed

+145
-6
lines changed

README.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ Profile MFE for local development via the `devstack`_.
7171
7272
Once the dev server is up, visit http://localhost:1995/u/staff.
7373

74+
Plugins
75+
=======
76+
This MFE can be customized using `Frontend Plugin Framework <https://github.com/openedx/frontend-plugin-framework>`_.
77+
78+
The parts of this MFE that can be customized in that manner are documented `here </src/plugin-slots>`_.
79+
7480
Configuration
7581
=============
7682

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
],
3030
"dependencies": {
3131
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
32-
"@edx/frontend-component-footer": "^14.0.0",
3332
"@edx/frontend-component-header": "5.3.1",
3433
"@edx/frontend-platform": "7.1.4",
3534
"@edx/openedx-atlas": "^0.6.0",
@@ -38,6 +37,7 @@
3837
"@fortawesome/free-regular-svg-icons": "6.5.2",
3938
"@fortawesome/free-solid-svg-icons": "6.5.2",
4039
"@fortawesome/react-fontawesome": "0.2.0",
40+
"@openedx/frontend-slot-footer": "^1.0.2",
4141
"@openedx/paragon": "^22.2.2",
4242
"@pact-foundation/pact": "^11.0.2",
4343
"@redux-devtools/extension": "3.3.0",

src/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import React from 'react';
1717
import ReactDOM from 'react-dom';
1818

1919
import Header from '@edx/frontend-component-header';
20-
import Footer from '@edx/frontend-component-footer';
20+
import FooterSlot from '@openedx/frontend-slot-footer';
2121

2222
import messages from './i18n';
2323
import configureStore from './data/configureStore';
@@ -35,7 +35,7 @@ subscribe(APP_READY, () => {
3535
<main id="main">
3636
<AppRoutes />
3737
</main>
38-
<Footer />
38+
<FooterSlot />
3939
</AppProvider>,
4040
document.getElementById('root'),
4141
);

src/plugin-slots/FooterSlot/README.md

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-slot-footer` repository](https://github.com/openedx/frontend-slot-footer/).
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+
```jsx
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+
```
13.2 KB
Loading
14 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-profile` Plugin Slots
2+
3+
* [`footer_slot`](./FooterSlot/)

0 commit comments

Comments
 (0)