-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This allows consuming MFEs to utilize a standardized Frontend Plugin Framework `PluginSlot` for replacing the footer.
- Loading branch information
1 parent
8b9f5fa
commit 0d4ea96
Showing
8 changed files
with
138 additions
and
1 deletion.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,48 @@ | ||
# Footer Slot | ||
|
||
### Slot ID: `footer_slot` | ||
|
||
## Description | ||
|
||
This slot is used to replace/modify/hide the footer. | ||
|
||
## Example | ||
|
||
The following `env.config.jsx` will replace the default footer. | ||
|
||
![Screenshot of Default Footer](./images/default_footer.png) | ||
|
||
with a simple custom footer | ||
|
||
![Screenshot of Custom Footer](./images/custom_footer.png) | ||
|
||
```js | ||
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework'; | ||
|
||
const config = { | ||
pluginSlots: { | ||
footer_slot: { | ||
plugins: [ | ||
{ | ||
// Hide the default footer | ||
op: PLUGIN_OPERATIONS.Hide, | ||
widgetId: 'default_contents', | ||
}, | ||
{ | ||
// Insert a custom footer | ||
op: PLUGIN_OPERATIONS.Insert, | ||
widget: { | ||
id: 'custom_footer', | ||
type: DIRECT_PLUGIN, | ||
RenderWidget: () => ( | ||
<h1 style={{textAlign: 'center'}}>🦶</h1> | ||
), | ||
}, | ||
}, | ||
] | ||
} | ||
}, | ||
} | ||
|
||
export default config; | ||
``` |
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,11 @@ | ||
import React from 'react'; | ||
import { PluginSlot } from '@openedx/frontend-plugin-framework'; | ||
import Footer from '../Footer'; | ||
|
||
const FooterSlot = () => ( | ||
<PluginSlot id="footer_slot"> | ||
<Footer /> | ||
</PluginSlot> | ||
); | ||
|
||
export default FooterSlot; |
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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
import Footer, { EVENT_NAMES } from './components/Footer'; | ||
import messages from './i18n/index'; | ||
import StudioFooter from './components/studio-footer'; | ||
import FooterSlot from './components/footer-slot'; | ||
|
||
export default Footer; | ||
export { messages, EVENT_NAMES, StudioFooter }; | ||
export { | ||
messages, EVENT_NAMES, StudioFooter, FooterSlot, | ||
}; |