generated from openedx/frontend-template-application
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support merging base component props, custom props, and `plugin…
…Props` via `slotOptions.mergeProps` (#84) * feat: support merging props with PluginOperations.Modify * fix: provide default content object for widget modification * chore: pr feedback * chore: consolidate examples * chore: remove content prop from LinkExample * chore: pr feedback, updating comment
- Loading branch information
1 parent
bf8705b
commit f34f4df
Showing
27 changed files
with
786 additions
and
142 deletions.
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
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
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 |
---|---|---|
@@ -1,31 +1,74 @@ | ||
import React from 'react'; | ||
import { | ||
Container, Row, Col, Stack, | ||
} from '@openedx/paragon'; | ||
|
||
import PluginSlotWithModifyDefaultContents from './pluginSlots/PluginSlotWithModifyDefaultContents'; | ||
import PluginSlotWithInsert from './pluginSlots/PluginSlotWithInsert'; | ||
import PluginSlotWithModifyWrapHide from './pluginSlots/PluginSlotWithModifyWrapHide'; | ||
import PluginSlotWithModularPlugins from './pluginSlots/PluginSlotWithModularPlugins'; | ||
import PluginSlotWithoutDefault from './pluginSlots/PluginSlotWithoutDefault'; | ||
|
||
const pluginExamples = [ | ||
{ | ||
id: 'plugin-operation-insert', | ||
label: 'Plugin Operation: Insert', | ||
Component: PluginSlotWithInsert, | ||
}, | ||
{ | ||
id: 'plugin-operation-modify-wrap-hide', | ||
label: 'Plugin Operation: Modify, Wrap, and Hide', | ||
Component: PluginSlotWithModifyWrapHide, | ||
}, | ||
{ | ||
id: 'plugin-operation-modify-default-content', | ||
label: 'Plugin Operation: Modify Default Content', | ||
Component: PluginSlotWithModifyDefaultContents, | ||
}, | ||
{ | ||
id: 'direct-plugins-modular-components', | ||
label: 'Direct Plugins Using Modular Components', | ||
Component: PluginSlotWithModularPlugins, | ||
}, | ||
{ | ||
id: 'no-default-content', | ||
label: 'Default Content Set to False', | ||
Component: PluginSlotWithoutDefault, | ||
}, | ||
]; | ||
|
||
export default function ExamplePage() { | ||
return ( | ||
<main className="center m-5"> | ||
<h1>Plugins Page</h1> | ||
|
||
<p> | ||
This page is here to help test the plugins module. A plugin configuration can be added in | ||
index.jsx and this page will display that plugin. | ||
</p> | ||
<p> | ||
To do this, a plugin MFE must be running on some other port. | ||
To make it a more realistic test, you may also want to edit your | ||
/etc/hosts file (or your system's equivalent) to provide an alternate domain for | ||
127.0.0.1 at which you can load the plugin. | ||
</p> | ||
<div className="d-flex flex-column"> | ||
<PluginSlotWithInsert /> | ||
<PluginSlotWithModifyWrapHide /> | ||
<PluginSlotWithModularPlugins /> | ||
<PluginSlotWithoutDefault /> | ||
</div> | ||
<main> | ||
<Container size="lg" className="py-3"> | ||
<Row> | ||
<Col> | ||
<h1>Plugins Page</h1> | ||
<p> | ||
This page is here to help test the plugins module. A plugin configuration can be added in | ||
index.jsx and this page will display that plugin. | ||
</p> | ||
<p> | ||
To do this, a plugin MFE must be running on some other port. | ||
To make it a more realistic test, you may also want to edit your | ||
/etc/hosts file (or your system's equivalent) to provide an alternate domain for | ||
127.0.0.1 at which you can load the plugin. | ||
</p> | ||
<h2>Examples</h2> | ||
<Stack gap={3}> | ||
<ul> | ||
{pluginExamples.map(({ id, label }) => ( | ||
<li key={id}> | ||
<a href={`#${id}`}>{label}</a> | ||
</li> | ||
))} | ||
</ul> | ||
<Stack gap={5}> | ||
{pluginExamples.map(({ Component, id, label }) => <Component key={id} id={id} label={label} />)} | ||
</Stack> | ||
</Stack> | ||
</Col> | ||
</Row> | ||
</Container> | ||
</main> | ||
); | ||
} |
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
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
Oops, something went wrong.