Skip to content

Commit 8ef9b42

Browse files
committed
feat: use frontend-plugin-framework to provide a FooterSlot
1 parent 897ec72 commit 8ef9b42

File tree

8 files changed

+154
-6
lines changed

8 files changed

+154
-6
lines changed

README-template-frontend-app.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@ Configuration
147147

148148
.. _feature and waffle flags: https://docs.openedx.org/projects/openedx-proposals/en/latest/best-practices/oep-0017-bp-feature-toggles.html
149149

150+
Plugins
151+
=======
152+
This MFE can be customized using `Frontend Plugin Framework <https://github.com/openedx/frontend-plugin-framework>`_.
153+
154+
The parts of this MFE that can be customized in that manner are documented `here </src/plugin-slots>`_.
155+
150156
[PLACEHOLDER: Other Relevant Sections]
151157
======================================
152158

package-lock.json

Lines changed: 92 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
@@ -35,14 +35,14 @@
3535
},
3636
"dependencies": {
3737
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
38-
"@edx/frontend-component-footer": "13.2.0",
3938
"@edx/frontend-component-header": "5.3.3",
4039
"@edx/frontend-platform": "7.1.4",
4140
"@fortawesome/fontawesome-svg-core": "1.2.36",
4241
"@fortawesome/free-brands-svg-icons": "5.15.4",
4342
"@fortawesome/free-regular-svg-icons": "5.15.4",
4443
"@fortawesome/free-solid-svg-icons": "5.15.4",
4544
"@fortawesome/react-fontawesome": "0.2.2",
45+
"@openedx/frontend-slot-footer": "^1.0.2",
4646
"@openedx/paragon": "^22.0.0",
4747
"core-js": "3.37.1",
4848
"prop-types": "15.8.1",

src/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { AppProvider, ErrorPage } from '@edx/frontend-platform/react';
88
import ReactDOM from 'react-dom';
99

1010
import Header from '@edx/frontend-component-header';
11-
import Footer from '@edx/frontend-component-footer';
11+
import FooterSlot from '@openedx/frontend-slot-footer';
1212
import messages from './i18n';
1313
import ExamplePage from './example/ExamplePage';
1414

@@ -19,7 +19,7 @@ subscribe(APP_READY, () => {
1919
<AppProvider>
2020
<Header />
2121
<ExamplePage />
22-
<Footer />
22+
<FooterSlot />
2323
</AppProvider>,
2424
document.getElementById('root'),
2525
);

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+
```
6.25 KB
Loading
6.52 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)