|
1 |
| -import React from 'react'; |
| 1 | +import { |
| 2 | + Container, Row, Col, Stack, |
| 3 | +} from '@openedx/paragon'; |
2 | 4 |
|
| 5 | +import PluginSlotWithModifyDefaultContents from './pluginSlots/PluginSlotWithModifyDefaultContents'; |
3 | 6 | import PluginSlotWithInsert from './pluginSlots/PluginSlotWithInsert';
|
4 | 7 | import PluginSlotWithModifyWrapHide from './pluginSlots/PluginSlotWithModifyWrapHide';
|
5 | 8 | import PluginSlotWithModularPlugins from './pluginSlots/PluginSlotWithModularPlugins';
|
6 | 9 | import PluginSlotWithoutDefault from './pluginSlots/PluginSlotWithoutDefault';
|
7 | 10 |
|
| 11 | +const pluginExamples = [ |
| 12 | + { |
| 13 | + id: 'plugin-operation-insert', |
| 14 | + label: 'Plugin Operation: Insert', |
| 15 | + Component: PluginSlotWithInsert, |
| 16 | + }, |
| 17 | + { |
| 18 | + id: 'plugin-operation-modify-wrap-hide', |
| 19 | + label: 'Plugin Operation: Modify, Wrap, and Hide', |
| 20 | + Component: PluginSlotWithModifyWrapHide, |
| 21 | + }, |
| 22 | + { |
| 23 | + id: 'plugin-operation-modify-default-content', |
| 24 | + label: 'Plugin Operation: Modify Default Content', |
| 25 | + Component: PluginSlotWithModifyDefaultContents, |
| 26 | + }, |
| 27 | + { |
| 28 | + id: 'direct-plugins-modular-components', |
| 29 | + label: 'Direct Plugins Using Modular Components', |
| 30 | + Component: PluginSlotWithModularPlugins, |
| 31 | + }, |
| 32 | + { |
| 33 | + id: 'no-default-content', |
| 34 | + label: 'Default Content Set to False', |
| 35 | + Component: PluginSlotWithoutDefault, |
| 36 | + }, |
| 37 | +]; |
| 38 | + |
8 | 39 | export default function ExamplePage() {
|
9 | 40 | return (
|
10 |
| - <main className="center m-5"> |
11 |
| - <h1>Plugins Page</h1> |
12 |
| - |
13 |
| - <p> |
14 |
| - This page is here to help test the plugins module. A plugin configuration can be added in |
15 |
| - index.jsx and this page will display that plugin. |
16 |
| - </p> |
17 |
| - <p> |
18 |
| - To do this, a plugin MFE must be running on some other port. |
19 |
| - To make it a more realistic test, you may also want to edit your |
20 |
| - /etc/hosts file (or your system's equivalent) to provide an alternate domain for |
21 |
| - 127.0.0.1 at which you can load the plugin. |
22 |
| - </p> |
23 |
| - <div className="d-flex flex-column"> |
24 |
| - <PluginSlotWithInsert /> |
25 |
| - <PluginSlotWithModifyWrapHide /> |
26 |
| - <PluginSlotWithModularPlugins /> |
27 |
| - <PluginSlotWithoutDefault /> |
28 |
| - </div> |
| 41 | + <main> |
| 42 | + <Container size="lg" className="py-3"> |
| 43 | + <Row> |
| 44 | + <Col> |
| 45 | + <h1>Plugins Page</h1> |
| 46 | + <p> |
| 47 | + This page is here to help test the plugins module. A plugin configuration can be added in |
| 48 | + index.jsx and this page will display that plugin. |
| 49 | + </p> |
| 50 | + <p> |
| 51 | + To do this, a plugin MFE must be running on some other port. |
| 52 | + To make it a more realistic test, you may also want to edit your |
| 53 | + /etc/hosts file (or your system's equivalent) to provide an alternate domain for |
| 54 | + 127.0.0.1 at which you can load the plugin. |
| 55 | + </p> |
| 56 | + <h2>Examples</h2> |
| 57 | + <Stack gap={3}> |
| 58 | + <ul> |
| 59 | + {pluginExamples.map(({ id, label }) => ( |
| 60 | + <li key={id}> |
| 61 | + <a href={`#${id}`}>{label}</a> |
| 62 | + </li> |
| 63 | + ))} |
| 64 | + </ul> |
| 65 | + <Stack gap={5}> |
| 66 | + {pluginExamples.map(({ Component, id, label }) => <Component key={id} id={id} label={label} />)} |
| 67 | + </Stack> |
| 68 | + </Stack> |
| 69 | + </Col> |
| 70 | + </Row> |
| 71 | + </Container> |
29 | 72 | </main>
|
30 | 73 | );
|
31 | 74 | }
|
0 commit comments