@epec-fcfm-uchile/frontend-component-header 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.rst +194 -0
- package/dist/Avatar.js +43 -0
- package/dist/Avatar.js.map +1 -0
- package/dist/Header.js +120 -0
- package/dist/Header.js.map +1 -0
- package/dist/Header.messages.js +110 -0
- package/dist/Header.messages.js.map +1 -0
- package/dist/Header.test.jsx +107 -0
- package/dist/Icons.js +52 -0
- package/dist/Icons.js.map +1 -0
- package/dist/Logo.js +28 -0
- package/dist/Logo.js.map +1 -0
- package/dist/Menu/Menu.js +321 -0
- package/dist/Menu/Menu.js.map +1 -0
- package/dist/Menu/index.js +3 -0
- package/dist/Menu/index.js.map +1 -0
- package/dist/Menu/menu.scss +45 -0
- package/dist/__snapshots__/Header.test.jsx.snap +445 -0
- package/dist/desktop-header/DesktopHeader.js +129 -0
- package/dist/desktop-header/DesktopHeader.js.map +1 -0
- package/dist/desktop-header/DesktopHeaderMainOrSecondaryMenu.js +51 -0
- package/dist/desktop-header/DesktopHeaderMainOrSecondaryMenu.js.map +1 -0
- package/dist/desktop-header/DesktopHeaderUserMenu.js +49 -0
- package/dist/desktop-header/DesktopHeaderUserMenu.js.map +1 -0
- package/dist/desktop-header/DesktopLoggedOutItems.js +22 -0
- package/dist/desktop-header/DesktopLoggedOutItems.js.map +1 -0
- package/dist/desktop-header/DesktopUserMenuToggle.js +25 -0
- package/dist/desktop-header/DesktopUserMenuToggle.js.map +1 -0
- package/dist/frontend-platform.d.ts +41 -0
- package/dist/generic/messages.js +15 -0
- package/dist/generic/messages.js.map +1 -0
- package/dist/i18n/index.js +2 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/index.scss +137 -0
- package/dist/learning-header/AnonymousUserMenu.js +22 -0
- package/dist/learning-header/AnonymousUserMenu.js.map +1 -0
- package/dist/learning-header/AuthenticatedUserDropdown.js +53 -0
- package/dist/learning-header/AuthenticatedUserDropdown.js.map +1 -0
- package/dist/learning-header/LearningHeader.js +59 -0
- package/dist/learning-header/LearningHeader.js.map +1 -0
- package/dist/learning-header/LearningHeaderCourseInfo.js +24 -0
- package/dist/learning-header/LearningHeaderCourseInfo.js.map +1 -0
- package/dist/learning-header/LearningHeaderHelpLink.js +13 -0
- package/dist/learning-header/LearningHeaderHelpLink.js.map +1 -0
- package/dist/learning-header/LearningHeaderUserMenuItems.js +20 -0
- package/dist/learning-header/LearningHeaderUserMenuItems.js.map +1 -0
- package/dist/learning-header/LearningLoggedOutButtons.js +24 -0
- package/dist/learning-header/LearningLoggedOutButtons.js.map +1 -0
- package/dist/learning-header/LearningUserMenuToggle.js +26 -0
- package/dist/learning-header/LearningUserMenuToggle.js.map +1 -0
- package/dist/learning-header/messages.js +45 -0
- package/dist/learning-header/messages.js.map +1 -0
- package/dist/mobile-header/MobileHeader.js +157 -0
- package/dist/mobile-header/MobileHeader.js.map +1 -0
- package/dist/mobile-header/MobileHeaderMainMenu.js +46 -0
- package/dist/mobile-header/MobileHeaderMainMenu.js.map +1 -0
- package/dist/mobile-header/MobileHeaderUserMenu.js +38 -0
- package/dist/mobile-header/MobileHeaderUserMenu.js.map +1 -0
- package/dist/mobile-header/MobileLoggedOutItems.js +27 -0
- package/dist/mobile-header/MobileLoggedOutItems.js.map +1 -0
- package/dist/mobile-header/MobileUserMenuToggle.js +19 -0
- package/dist/mobile-header/MobileUserMenuToggle.js.map +1 -0
- package/dist/plugin-slots/CourseInfoSlot/README.md +128 -0
- package/dist/plugin-slots/CourseInfoSlot/images/add_custom_components_before_and_after_course_info.png +0 -0
- package/dist/plugin-slots/CourseInfoSlot/images/replace_course_info_with_custom_component.png +0 -0
- package/dist/plugin-slots/CourseInfoSlot/images/replace_course_title.png +0 -0
- package/dist/plugin-slots/CourseInfoSlot/index.js +32 -0
- package/dist/plugin-slots/CourseInfoSlot/index.js.map +1 -0
- package/dist/plugin-slots/DesktopHeaderSlot/README.md +44 -0
- package/dist/plugin-slots/DesktopHeaderSlot/images/desktop_header_custom_component.png +0 -0
- package/dist/plugin-slots/DesktopHeaderSlot/index.js +16 -0
- package/dist/plugin-slots/DesktopHeaderSlot/index.js.map +1 -0
- package/dist/plugin-slots/DesktopLoggedOutItemsSlot/README.md +137 -0
- package/dist/plugin-slots/DesktopLoggedOutItemsSlot/images/desktop_logged_out_items_custom_component.png +0 -0
- package/dist/plugin-slots/DesktopLoggedOutItemsSlot/images/desktop_logged_out_items_custom_components_before_after.png +0 -0
- package/dist/plugin-slots/DesktopLoggedOutItemsSlot/images/desktop_logged_out_items_modify_items.png +0 -0
- package/dist/plugin-slots/DesktopLoggedOutItemsSlot/index.js +20 -0
- package/dist/plugin-slots/DesktopLoggedOutItemsSlot/index.js.map +1 -0
- package/dist/plugin-slots/DesktopMainMenuSlot/README.md +190 -0
- package/dist/plugin-slots/DesktopMainMenuSlot/images/desktop_main_menu_add_items.png +0 -0
- package/dist/plugin-slots/DesktopMainMenuSlot/images/desktop_main_menu_custom_component.png +0 -0
- package/dist/plugin-slots/DesktopMainMenuSlot/images/desktop_main_menu_custom_components_before_after.png +0 -0
- package/dist/plugin-slots/DesktopMainMenuSlot/images/desktop_main_menu_replace_all_items.png +0 -0
- package/dist/plugin-slots/DesktopMainMenuSlot/index.js +20 -0
- package/dist/plugin-slots/DesktopMainMenuSlot/index.js.map +1 -0
- package/dist/plugin-slots/DesktopSecondaryMenuSlot/README.md +132 -0
- package/dist/plugin-slots/DesktopSecondaryMenuSlot/images/desktop_secondary_menu_custom_component.png +0 -0
- package/dist/plugin-slots/DesktopSecondaryMenuSlot/images/desktop_secondary_menu_custom_components_before_after.png +0 -0
- package/dist/plugin-slots/DesktopSecondaryMenuSlot/images/desktop_secondary_menu_modify_items.png +0 -0
- package/dist/plugin-slots/DesktopSecondaryMenuSlot/index.js +20 -0
- package/dist/plugin-slots/DesktopSecondaryMenuSlot/index.js.map +1 -0
- package/dist/plugin-slots/DesktopUserMenuSlot/README.md +144 -0
- package/dist/plugin-slots/DesktopUserMenuSlot/images/desktop_user_menu_custom_component.png +0 -0
- package/dist/plugin-slots/DesktopUserMenuSlot/images/desktop_user_menu_custom_components_before_after.png +0 -0
- package/dist/plugin-slots/DesktopUserMenuSlot/images/desktop_user_menu_modify_items.png +0 -0
- package/dist/plugin-slots/DesktopUserMenuSlot/index.js +20 -0
- package/dist/plugin-slots/DesktopUserMenuSlot/index.js.map +1 -0
- package/dist/plugin-slots/DesktopUserMenuToggleSlot/README.md +74 -0
- package/dist/plugin-slots/DesktopUserMenuToggleSlot/images/desktop_user_menu_custom_component.png +0 -0
- package/dist/plugin-slots/DesktopUserMenuToggleSlot/images/desktop_user_menu_modified_toggle.png +0 -0
- package/dist/plugin-slots/DesktopUserMenuToggleSlot/index.js +19 -0
- package/dist/plugin-slots/DesktopUserMenuToggleSlot/index.js.map +1 -0
- package/dist/plugin-slots/LearningHelpSlot/README.md +44 -0
- package/dist/plugin-slots/LearningHelpSlot/images/learning_help_custom_component.png +0 -0
- package/dist/plugin-slots/LearningHelpSlot/index.js +11 -0
- package/dist/plugin-slots/LearningHelpSlot/index.js.map +1 -0
- package/dist/plugin-slots/LearningLoggedOutItemsSlot/README.md +135 -0
- package/dist/plugin-slots/LearningLoggedOutItemsSlot/images/learning_logged_out_items_custom_component.png +0 -0
- package/dist/plugin-slots/LearningLoggedOutItemsSlot/images/learning_logged_out_items_custom_components_before_after.png +0 -0
- package/dist/plugin-slots/LearningLoggedOutItemsSlot/images/learning_logged_out_items_modified_items.png +0 -0
- package/dist/plugin-slots/LearningLoggedOutItemsSlot/index.js +18 -0
- package/dist/plugin-slots/LearningLoggedOutItemsSlot/index.js.map +1 -0
- package/dist/plugin-slots/LearningUserMenuSlot/README.md +133 -0
- package/dist/plugin-slots/LearningUserMenuSlot/images/learning_user_menu_custom_component.png +0 -0
- package/dist/plugin-slots/LearningUserMenuSlot/images/learning_user_menu_custom_components_before_after.png +0 -0
- package/dist/plugin-slots/LearningUserMenuSlot/images/learning_user_menu_modified_items.png +0 -0
- package/dist/plugin-slots/LearningUserMenuSlot/index.js +18 -0
- package/dist/plugin-slots/LearningUserMenuSlot/index.js.map +1 -0
- package/dist/plugin-slots/LearningUserMenuToggleSlot/README.md +74 -0
- package/dist/plugin-slots/LearningUserMenuToggleSlot/images/learning_user_menu_toggle_custom_component.png +0 -0
- package/dist/plugin-slots/LearningUserMenuToggleSlot/images/learning_user_menu_toggle_modified_items.png +0 -0
- package/dist/plugin-slots/LearningUserMenuToggleSlot/index.js +19 -0
- package/dist/plugin-slots/LearningUserMenuToggleSlot/index.js.map +1 -0
- package/dist/plugin-slots/LogoSlot/README.md +72 -0
- package/dist/plugin-slots/LogoSlot/index.js +27 -0
- package/dist/plugin-slots/LogoSlot/index.js.map +1 -0
- package/dist/plugin-slots/MobileHeaderSlot/README.md +44 -0
- package/dist/plugin-slots/MobileHeaderSlot/images/mobile_header_custom_component.png +0 -0
- package/dist/plugin-slots/MobileHeaderSlot/index.js +16 -0
- package/dist/plugin-slots/MobileHeaderSlot/index.js.map +1 -0
- package/dist/plugin-slots/MobileLoggedOutItemsSlot/README.md +136 -0
- package/dist/plugin-slots/MobileLoggedOutItemsSlot/images/mobile_logged_out_items_custom_component.png +0 -0
- package/dist/plugin-slots/MobileLoggedOutItemsSlot/images/mobile_logged_out_items_custom_components_before_after.png +0 -0
- package/dist/plugin-slots/MobileLoggedOutItemsSlot/images/mobile_logged_out_items_modify_items.png +0 -0
- package/dist/plugin-slots/MobileLoggedOutItemsSlot/index.js +20 -0
- package/dist/plugin-slots/MobileLoggedOutItemsSlot/index.js.map +1 -0
- package/dist/plugin-slots/MobileMainMenuSlot/README.md +190 -0
- package/dist/plugin-slots/MobileMainMenuSlot/images/mobile_main_menu_add_items.png +0 -0
- package/dist/plugin-slots/MobileMainMenuSlot/images/mobile_main_menu_custom_component.png +0 -0
- package/dist/plugin-slots/MobileMainMenuSlot/images/mobile_main_menu_custom_components_before_after.png +0 -0
- package/dist/plugin-slots/MobileMainMenuSlot/images/mobile_main_menu_replace_all_items.png +0 -0
- package/dist/plugin-slots/MobileMainMenuSlot/index.js +20 -0
- package/dist/plugin-slots/MobileMainMenuSlot/index.js.map +1 -0
- package/dist/plugin-slots/MobileUserMenuSlot/README.md +144 -0
- package/dist/plugin-slots/MobileUserMenuSlot/images/mobile_user_menu_custom_component.png +0 -0
- package/dist/plugin-slots/MobileUserMenuSlot/images/mobile_user_menu_custom_components_before_after.png +0 -0
- package/dist/plugin-slots/MobileUserMenuSlot/images/mobile_user_menu_modify_items.png +0 -0
- package/dist/plugin-slots/MobileUserMenuSlot/index.js +20 -0
- package/dist/plugin-slots/MobileUserMenuSlot/index.js.map +1 -0
- package/dist/plugin-slots/MobileUserMenuToggleSlot/README.md +74 -0
- package/dist/plugin-slots/MobileUserMenuToggleSlot/images/mobile_user_menu_toggle_custom_component.png +0 -0
- package/dist/plugin-slots/MobileUserMenuToggleSlot/images/mobile_user_menu_toggle_modified_items.png +0 -0
- package/dist/plugin-slots/MobileUserMenuToggleSlot/index.js +19 -0
- package/dist/plugin-slots/MobileUserMenuToggleSlot/index.js.map +1 -0
- package/dist/plugin-slots/README.md +26 -0
- package/dist/setupTest.js +123 -0
- package/dist/studio-header/BrandNav.test.tsx +40 -0
- package/dist/studio-header/BrandNav.tsx +25 -0
- package/dist/studio-header/CourseLockUp.test.tsx +59 -0
- package/dist/studio-header/CourseLockUp.tsx +58 -0
- package/dist/studio-header/HeaderBody.test.tsx +102 -0
- package/dist/studio-header/HeaderBody.tsx +196 -0
- package/dist/studio-header/MobileHeader.tsx +74 -0
- package/dist/studio-header/MobileMenu.test.tsx +81 -0
- package/dist/studio-header/MobileMenu.tsx +50 -0
- package/dist/studio-header/NavDropdownMenu.test.tsx +67 -0
- package/dist/studio-header/NavDropdownMenu.tsx +42 -0
- package/dist/studio-header/StudioHeader.scss +49 -0
- package/dist/studio-header/StudioHeader.test.tsx +200 -0
- package/dist/studio-header/StudioHeader.tsx +84 -0
- package/dist/studio-header/UserMenu.tsx +66 -0
- package/dist/studio-header/index.ts +3 -0
- package/dist/studio-header/messages.ts +56 -0
- package/dist/studio-header/utils.ts +33 -0
- package/dist/test-utils.js +25 -0
- package/dist/test-utils.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PluginSlot","LearningHeaderUserMenuItems","learningHeaderUserMenuDataShape","LearningUserMenuSlot","_ref","items","createElement","id","idAliases","slotOptions","mergeProps","propTypes"],"sources":["../../../src/plugin-slots/LearningUserMenuSlot/index.jsx"],"sourcesContent":["import React from 'react';\nimport { PluginSlot } from '@openedx/frontend-plugin-framework';\nimport LearningHeaderUserMenuItems, { learningHeaderUserMenuDataShape } from '../../learning-header/LearningHeaderUserMenuItems';\n\nconst LearningUserMenuSlot = ({\n items,\n}) => (\n <PluginSlot\n id=\"org.openedx.frontend.layout.header_learning_user_menu.v1\"\n idAliases={['learning_user_menu_slot']}\n slotOptions={{\n mergeProps: true,\n }}\n >\n <LearningHeaderUserMenuItems items={items} />\n </PluginSlot>\n);\n\nLearningUserMenuSlot.propTypes = learningHeaderUserMenuDataShape;\n\nexport default LearningUserMenuSlot;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,oCAAoC;AAC/D,OAAOC,2BAA2B,IAAIC,+BAA+B,QAAQ,mDAAmD;AAEhI,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAAC,IAAA;EAAA,IACxBC,KAAK,GAAAD,IAAA,CAALC,KAAK;EAAA,oBAELN,KAAA,CAAAO,aAAA,CAACN,UAAU;IACTO,EAAE,EAAC,0DAA0D;IAC7DC,SAAS,EAAE,CAAC,yBAAyB,CAAE;IACvCC,WAAW,EAAE;MACXC,UAAU,EAAE;IACd;EAAE,gBAEFX,KAAA,CAAAO,aAAA,CAACL,2BAA2B;IAACI,KAAK,EAAEA;EAAM,CAAE,CAClC,CAAC;AAAA,CACd;AAEDF,oBAAoB,CAACQ,SAAS,GAAGT,+BAA+B;AAEhE,eAAeC,oBAAoB","ignoreList":[]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Learning User Menu Toggle Slot
|
|
2
|
+
|
|
3
|
+
### Slot ID: `org.openedx.frontend.layout.header_learning_user_menu_toggle.v1`
|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
This slot is used to replace/modify/hide the contents of the learning user menu toggle button.
|
|
8
|
+
|
|
9
|
+
## Examples
|
|
10
|
+
|
|
11
|
+
### Modify Icon
|
|
12
|
+
|
|
13
|
+
The following `env.config.jsx` will modify the icon for the learning user menu toggle button. **Note:** The icon is only shown on mobile screens.
|
|
14
|
+
|
|
15
|
+

|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
import { PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
19
|
+
import { faHouse } from '@fortawesome/free-solid-svg-icons';
|
|
20
|
+
|
|
21
|
+
const modifyUserMenuToggle = ( widget ) => {
|
|
22
|
+
widget.content.icon = faHouse;
|
|
23
|
+
return widget;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const config = {
|
|
27
|
+
pluginSlots: {
|
|
28
|
+
'org.openedx.frontend.layout.header_learning_user_menu_toggle.v1': {
|
|
29
|
+
keepDefault: true,
|
|
30
|
+
plugins: [
|
|
31
|
+
{
|
|
32
|
+
op: PLUGIN_OPERATIONS.Modify,
|
|
33
|
+
widgetId: 'default_contents',
|
|
34
|
+
fn: modifyUserMenuToggle,
|
|
35
|
+
},
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default config;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Replace Menu toggle contents with Custom Component
|
|
45
|
+
|
|
46
|
+
The following `env.config.jsx` will replace the contents of the learning user menu toggle button's contents entirely (in this case with an emoji)
|
|
47
|
+
|
|
48
|
+

|
|
49
|
+
|
|
50
|
+
```jsx
|
|
51
|
+
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
52
|
+
|
|
53
|
+
const config = {
|
|
54
|
+
pluginSlots: {
|
|
55
|
+
'org.openedx.frontend.layout.header_learning_user_menu_toggle.v1': {
|
|
56
|
+
keepDefault: false,
|
|
57
|
+
plugins: [
|
|
58
|
+
{
|
|
59
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
60
|
+
widget: {
|
|
61
|
+
id: 'custom_learning_user_menu_toggle',
|
|
62
|
+
type: DIRECT_PLUGIN,
|
|
63
|
+
RenderWidget: () => (
|
|
64
|
+
<span>π¦</span>
|
|
65
|
+
),
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default config;
|
|
74
|
+
```
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PluginSlot } from '@openedx/frontend-plugin-framework';
|
|
3
|
+
import LearningUserMenuToggle, { LearningUserMenuTogglePropTypes } from '../../learning-header/LearningUserMenuToggle';
|
|
4
|
+
var LearningUserMenuToggleSlot = function LearningUserMenuToggleSlot(_ref) {
|
|
5
|
+
var label = _ref.label,
|
|
6
|
+
icon = _ref.icon;
|
|
7
|
+
return /*#__PURE__*/React.createElement(PluginSlot, {
|
|
8
|
+
id: "org.openedx.frontend.layout.header_learning_user_menu_toggle.v1",
|
|
9
|
+
slotOptions: {
|
|
10
|
+
mergeProps: true
|
|
11
|
+
}
|
|
12
|
+
}, /*#__PURE__*/React.createElement(LearningUserMenuToggle, {
|
|
13
|
+
label: label,
|
|
14
|
+
icon: icon
|
|
15
|
+
}));
|
|
16
|
+
};
|
|
17
|
+
LearningUserMenuToggleSlot.propTypes = LearningUserMenuTogglePropTypes;
|
|
18
|
+
export default LearningUserMenuToggleSlot;
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PluginSlot","LearningUserMenuToggle","LearningUserMenuTogglePropTypes","LearningUserMenuToggleSlot","_ref","label","icon","createElement","id","slotOptions","mergeProps","propTypes"],"sources":["../../../src/plugin-slots/LearningUserMenuToggleSlot/index.jsx"],"sourcesContent":["import React from 'react';\nimport { PluginSlot } from '@openedx/frontend-plugin-framework';\nimport LearningUserMenuToggle, {\n LearningUserMenuTogglePropTypes,\n} from '../../learning-header/LearningUserMenuToggle';\n\nconst LearningUserMenuToggleSlot = ({\n label, icon,\n}) => (\n <PluginSlot\n id=\"org.openedx.frontend.layout.header_learning_user_menu_toggle.v1\"\n slotOptions={{\n mergeProps: true,\n }}\n >\n <LearningUserMenuToggle label={label} icon={icon} />\n </PluginSlot>\n);\n\nLearningUserMenuToggleSlot.propTypes = LearningUserMenuTogglePropTypes;\n\nexport default LearningUserMenuToggleSlot;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,oCAAoC;AAC/D,OAAOC,sBAAsB,IAC3BC,+BAA+B,QAC1B,8CAA8C;AAErD,IAAMC,0BAA0B,GAAG,SAA7BA,0BAA0BA,CAAAC,IAAA;EAAA,IAC9BC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,IAAI,GAAAF,IAAA,CAAJE,IAAI;EAAA,oBAEXP,KAAA,CAAAQ,aAAA,CAACP,UAAU;IACTQ,EAAE,EAAC,iEAAiE;IACpEC,WAAW,EAAE;MACXC,UAAU,EAAE;IACd;EAAE,gBAEFX,KAAA,CAAAQ,aAAA,CAACN,sBAAsB;IAACI,KAAK,EAAEA,KAAM;IAACC,IAAI,EAAEA;EAAK,CAAE,CACzC,CAAC;AAAA,CACd;AAEDH,0BAA0B,CAACQ,SAAS,GAAGT,+BAA+B;AAEtE,eAAeC,0BAA0B","ignoreList":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Logo Slot
|
|
2
|
+
|
|
3
|
+
### Slot ID: `org.openedx.frontend.layout.header_logo.v1`
|
|
4
|
+
|
|
5
|
+
### Slot ID Aliases
|
|
6
|
+
* `logo_slot`
|
|
7
|
+
|
|
8
|
+
## Description
|
|
9
|
+
|
|
10
|
+
This slot is used to replace/modify/hide the logo.
|
|
11
|
+
|
|
12
|
+
## Examples
|
|
13
|
+
|
|
14
|
+
### Modify URL
|
|
15
|
+
|
|
16
|
+
The following `env.config.jsx` will modify the link href for the logo.
|
|
17
|
+
|
|
18
|
+
```jsx
|
|
19
|
+
import { PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
20
|
+
|
|
21
|
+
const modifyLogoHref = ( widget ) => {
|
|
22
|
+
widget.content.href = "https://openedx.org/";
|
|
23
|
+
return widget;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const config = {
|
|
27
|
+
pluginSlots: {
|
|
28
|
+
'org.openedx.frontend.layout.header_logo.v1': {
|
|
29
|
+
keepDefault: true,
|
|
30
|
+
plugins: [
|
|
31
|
+
{
|
|
32
|
+
op: PLUGIN_OPERATIONS.Modify,
|
|
33
|
+
widgetId: 'default_contents',
|
|
34
|
+
fn: modifyLogoHref,
|
|
35
|
+
},
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default config;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Custom Component
|
|
45
|
+
|
|
46
|
+
The following `env.config.jsx` will replace the logo entirely (in this case with a centered πΊοΈ `h1`)
|
|
47
|
+
|
|
48
|
+
```jsx
|
|
49
|
+
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
50
|
+
|
|
51
|
+
const config = {
|
|
52
|
+
pluginSlots: {
|
|
53
|
+
'org.openedx.frontend.layout.header_logo.v1': {
|
|
54
|
+
keepDefault: false,
|
|
55
|
+
plugins: [
|
|
56
|
+
{
|
|
57
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
58
|
+
widget: {
|
|
59
|
+
id: 'custom_logo_component',
|
|
60
|
+
type: DIRECT_PLUGIN,
|
|
61
|
+
RenderWidget: () => (
|
|
62
|
+
<h1 style={{textAlign: 'center'}}>πΊοΈ</h1>
|
|
63
|
+
),
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default config;
|
|
72
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var _excluded = ["href", "src", "alt"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { PluginSlot } from '@openedx/frontend-plugin-framework';
|
|
7
|
+
import Logo, { logoDataShape } from '../../Logo';
|
|
8
|
+
var LogoSlot = function LogoSlot(_ref) {
|
|
9
|
+
var href = _ref.href,
|
|
10
|
+
src = _ref.src,
|
|
11
|
+
alt = _ref.alt,
|
|
12
|
+
attributes = _objectWithoutProperties(_ref, _excluded);
|
|
13
|
+
return /*#__PURE__*/React.createElement(PluginSlot, {
|
|
14
|
+
id: "org.openedx.frontend.layout.header_logo.v1",
|
|
15
|
+
idAliases: ['logo_slot'],
|
|
16
|
+
slotOptions: {
|
|
17
|
+
mergeProps: true
|
|
18
|
+
}
|
|
19
|
+
}, /*#__PURE__*/React.createElement(Logo, _extends({
|
|
20
|
+
href: href,
|
|
21
|
+
src: src,
|
|
22
|
+
alt: alt
|
|
23
|
+
}, attributes)));
|
|
24
|
+
};
|
|
25
|
+
LogoSlot.propTypes = logoDataShape;
|
|
26
|
+
export default LogoSlot;
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PluginSlot","Logo","logoDataShape","LogoSlot","_ref","href","src","alt","attributes","_objectWithoutProperties","_excluded","createElement","id","idAliases","slotOptions","mergeProps","_extends","propTypes"],"sources":["../../../src/plugin-slots/LogoSlot/index.jsx"],"sourcesContent":["import React from 'react';\nimport { PluginSlot } from '@openedx/frontend-plugin-framework';\nimport Logo, { logoDataShape } from '../../Logo';\n\nconst LogoSlot = ({\n href, src, alt, ...attributes\n}) => (\n <PluginSlot\n id=\"org.openedx.frontend.layout.header_logo.v1\"\n idAliases={['logo_slot']}\n slotOptions={{\n mergeProps: true,\n }}\n >\n <Logo href={href} src={src} alt={alt} {...attributes} />\n </PluginSlot>\n);\n\nLogoSlot.propTypes = logoDataShape;\n\nexport default LogoSlot;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,oCAAoC;AAC/D,OAAOC,IAAI,IAAIC,aAAa,QAAQ,YAAY;AAEhD,IAAMC,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA;EAAA,IACZC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IAAEC,GAAG,GAAAF,IAAA,CAAHE,GAAG;IAAEC,GAAG,GAAAH,IAAA,CAAHG,GAAG;IAAKC,UAAU,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA;EAAA,oBAE7BX,KAAA,CAAAY,aAAA,CAACX,UAAU;IACTY,EAAE,EAAC,4CAA4C;IAC/CC,SAAS,EAAE,CAAC,WAAW,CAAE;IACzBC,WAAW,EAAE;MACXC,UAAU,EAAE;IACd;EAAE,gBAEFhB,KAAA,CAAAY,aAAA,CAACV,IAAI,EAAAe,QAAA;IAACX,IAAI,EAAEA,IAAK;IAACC,GAAG,EAAEA,GAAI;IAACC,GAAG,EAAEA;EAAI,GAAKC,UAAU,CAAG,CAC7C,CAAC;AAAA,CACd;AAEDL,QAAQ,CAACc,SAAS,GAAGf,aAAa;AAElC,eAAeC,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Mobile Header Slot
|
|
2
|
+
|
|
3
|
+
### Slot ID: `org.openedx.frontend.layout.header_mobile.v1`
|
|
4
|
+
|
|
5
|
+
### Slot ID Aliases
|
|
6
|
+
* `mobile_header_slot`
|
|
7
|
+
|
|
8
|
+
## Description
|
|
9
|
+
|
|
10
|
+
This slot is used to replace/modify/hide the entire mobile header.
|
|
11
|
+
|
|
12
|
+
## Examples
|
|
13
|
+
|
|
14
|
+
### Custom Component
|
|
15
|
+
|
|
16
|
+
The following `env.config.jsx` will replace the mobile header entirely (in this case with a centered πΊοΈ `h1`)
|
|
17
|
+
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
```jsx
|
|
21
|
+
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
22
|
+
|
|
23
|
+
const config = {
|
|
24
|
+
pluginSlots: {
|
|
25
|
+
'org.openedx.frontend.layout.header_mobile.v1': {
|
|
26
|
+
keepDefault: false,
|
|
27
|
+
plugins: [
|
|
28
|
+
{
|
|
29
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
30
|
+
widget: {
|
|
31
|
+
id: 'custom_mobile_header_component',
|
|
32
|
+
type: DIRECT_PLUGIN,
|
|
33
|
+
RenderWidget: () => (
|
|
34
|
+
<h1 style={{textAlign: 'center'}}>πΊοΈ</h1>
|
|
35
|
+
),
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default config;
|
|
44
|
+
```
|
|
Binary file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PluginSlot } from '@openedx/frontend-plugin-framework';
|
|
3
|
+
import MobileHeader, { mobileHeaderDataShape } from '../../mobile-header/MobileHeader';
|
|
4
|
+
var MobileHeaderSlot = function MobileHeaderSlot(_ref) {
|
|
5
|
+
var props = _ref.props;
|
|
6
|
+
return /*#__PURE__*/React.createElement(PluginSlot, {
|
|
7
|
+
id: "org.openedx.frontend.layout.header_mobile.v1",
|
|
8
|
+
idAliases: ['mobile_header_slot'],
|
|
9
|
+
slotOptions: {
|
|
10
|
+
mergeProps: true
|
|
11
|
+
}
|
|
12
|
+
}, /*#__PURE__*/React.createElement(MobileHeader, props));
|
|
13
|
+
};
|
|
14
|
+
MobileHeaderSlot.propTypes = mobileHeaderDataShape;
|
|
15
|
+
export default MobileHeaderSlot;
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PluginSlot","MobileHeader","mobileHeaderDataShape","MobileHeaderSlot","_ref","props","createElement","id","idAliases","slotOptions","mergeProps","propTypes"],"sources":["../../../src/plugin-slots/MobileHeaderSlot/index.jsx"],"sourcesContent":["import React from 'react';\nimport { PluginSlot } from '@openedx/frontend-plugin-framework';\nimport MobileHeader, { mobileHeaderDataShape } from '../../mobile-header/MobileHeader';\n\nconst MobileHeaderSlot = ({\n props,\n}) => (\n <PluginSlot\n id=\"org.openedx.frontend.layout.header_mobile.v1\"\n idAliases={['mobile_header_slot']}\n slotOptions={{\n mergeProps: true,\n }}\n >\n <MobileHeader {...props} />\n </PluginSlot>\n);\n\nMobileHeaderSlot.propTypes = mobileHeaderDataShape;\n\nexport default MobileHeaderSlot;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,oCAAoC;AAC/D,OAAOC,YAAY,IAAIC,qBAAqB,QAAQ,kCAAkC;AAEtF,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA;EAAA,IACpBC,KAAK,GAAAD,IAAA,CAALC,KAAK;EAAA,oBAELN,KAAA,CAAAO,aAAA,CAACN,UAAU;IACTO,EAAE,EAAC,8CAA8C;IACjDC,SAAS,EAAE,CAAC,oBAAoB,CAAE;IAClCC,WAAW,EAAE;MACXC,UAAU,EAAE;IACd;EAAE,gBAEFX,KAAA,CAAAO,aAAA,CAACL,YAAY,EAAKI,KAAQ,CAChB,CAAC;AAAA,CACd;AAEDF,gBAAgB,CAACQ,SAAS,GAAGT,qBAAqB;AAElD,eAAeC,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Mobile Logged Out Items Slot
|
|
2
|
+
|
|
3
|
+
### Slot ID: `org.openedx.frontend.layout.header_mobile_logged_out_items.v1`
|
|
4
|
+
|
|
5
|
+
### Slot ID Aliases
|
|
6
|
+
* `mobile_logged_out_items_slot`
|
|
7
|
+
|
|
8
|
+
## Description
|
|
9
|
+
|
|
10
|
+
This slot is used to replace/modify/hide the mobile user menu when logged out.
|
|
11
|
+
|
|
12
|
+
## Examples
|
|
13
|
+
|
|
14
|
+
### Modify Items
|
|
15
|
+
|
|
16
|
+
The following `env.config.jsx` will modify the items in mobile user menu when logged out.
|
|
17
|
+
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
```jsx
|
|
21
|
+
import { PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
22
|
+
|
|
23
|
+
const modifyLoggedOutItems = ( widget ) => {
|
|
24
|
+
widget.content.items = [
|
|
25
|
+
{
|
|
26
|
+
type: 'item',
|
|
27
|
+
href: 'https://openedx.org/',
|
|
28
|
+
content: 'openedx.org',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'item',
|
|
32
|
+
href: 'https://docs.openedx.org/en/latest/',
|
|
33
|
+
content: 'Documentation',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
type: 'item',
|
|
37
|
+
href: 'https://discuss.openedx.org/',
|
|
38
|
+
content: 'Forums',
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
return widget;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const config = {
|
|
45
|
+
pluginSlots: {
|
|
46
|
+
'org.openedx.frontend.layout.header_mobile_logged_out_items.v1': {
|
|
47
|
+
keepDefault: true,
|
|
48
|
+
plugins: [
|
|
49
|
+
{
|
|
50
|
+
op: PLUGIN_OPERATIONS.Modify,
|
|
51
|
+
widgetId: 'default_contents',
|
|
52
|
+
fn: modifyLoggedOutItems,
|
|
53
|
+
},
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default config;
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Replace Items with Custom Component
|
|
63
|
+
|
|
64
|
+
The following `env.config.jsx` will replace the items in mobile user menu when logged out entirely (in this case with a centered πΊοΈ `h1`)
|
|
65
|
+
|
|
66
|
+

|
|
67
|
+
|
|
68
|
+
```jsx
|
|
69
|
+
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
70
|
+
|
|
71
|
+
const config = {
|
|
72
|
+
pluginSlots: {
|
|
73
|
+
'org.openedx.frontend.layout.header_mobile_logged_out_items.v1': {
|
|
74
|
+
keepDefault: false,
|
|
75
|
+
plugins: [
|
|
76
|
+
{
|
|
77
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
78
|
+
widget: {
|
|
79
|
+
id: 'custom_logged_out_items_component',
|
|
80
|
+
type: DIRECT_PLUGIN,
|
|
81
|
+
RenderWidget: () => (
|
|
82
|
+
<h1 style={{textAlign: 'center'}}>πΊοΈ</h1>
|
|
83
|
+
),
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export default config;
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Add Custom Components before and after Items
|
|
95
|
+
|
|
96
|
+
The following `env.config.jsx` will place custom components before and after the items in mobile user menu when logged out (in this case centered `h1`s with π and π).
|
|
97
|
+
|
|
98
|
+

|
|
99
|
+
|
|
100
|
+
```jsx
|
|
101
|
+
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
102
|
+
|
|
103
|
+
const config = {
|
|
104
|
+
pluginSlots: {
|
|
105
|
+
'org.openedx.frontend.layout.header_mobile_logged_out_items.v1': {
|
|
106
|
+
keepDefault: true,
|
|
107
|
+
plugins: [
|
|
108
|
+
{
|
|
109
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
110
|
+
widget: {
|
|
111
|
+
id: 'custom_before_logged_out_items_component',
|
|
112
|
+
type: DIRECT_PLUGIN,
|
|
113
|
+
priority: 10,
|
|
114
|
+
RenderWidget: () => (
|
|
115
|
+
<h1 style={{textAlign: 'center'}}>π</h1>
|
|
116
|
+
),
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
121
|
+
widget: {
|
|
122
|
+
id: 'custom_after_logged_out_items_component',
|
|
123
|
+
type: DIRECT_PLUGIN,
|
|
124
|
+
priority: 90,
|
|
125
|
+
RenderWidget: () => (
|
|
126
|
+
<h1 style={{textAlign: 'center'}}>π</h1>
|
|
127
|
+
),
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export default config;
|
|
136
|
+
```
|
|
Binary file
|
|
Binary file
|
package/dist/plugin-slots/MobileLoggedOutItemsSlot/images/mobile_logged_out_items_modify_items.png
ADDED
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PluginSlot } from '@openedx/frontend-plugin-framework';
|
|
3
|
+
import MobileLoggedOutItems, { mobileHeaderLoggedOutItemsDataShape } from '../../mobile-header/MobileLoggedOutItems';
|
|
4
|
+
var MobileLoggedOutItemsSlot = function MobileLoggedOutItemsSlot(_ref) {
|
|
5
|
+
var items = _ref.items;
|
|
6
|
+
return /*#__PURE__*/React.createElement(PluginSlot, {
|
|
7
|
+
id: "org.openedx.frontend.layout.header_mobile_logged_out_items.v1",
|
|
8
|
+
idAliases: ['mobile_logged_out_items_slot'],
|
|
9
|
+
slotOptions: {
|
|
10
|
+
mergeProps: true
|
|
11
|
+
}
|
|
12
|
+
}, /*#__PURE__*/React.createElement(MobileLoggedOutItems, {
|
|
13
|
+
items: items
|
|
14
|
+
}));
|
|
15
|
+
};
|
|
16
|
+
MobileLoggedOutItemsSlot.propTypes = {
|
|
17
|
+
items: mobileHeaderLoggedOutItemsDataShape
|
|
18
|
+
};
|
|
19
|
+
export default MobileLoggedOutItemsSlot;
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PluginSlot","MobileLoggedOutItems","mobileHeaderLoggedOutItemsDataShape","MobileLoggedOutItemsSlot","_ref","items","createElement","id","idAliases","slotOptions","mergeProps","propTypes"],"sources":["../../../src/plugin-slots/MobileLoggedOutItemsSlot/index.jsx"],"sourcesContent":["import React from 'react';\nimport { PluginSlot } from '@openedx/frontend-plugin-framework';\nimport MobileLoggedOutItems, { mobileHeaderLoggedOutItemsDataShape } from '../../mobile-header/MobileLoggedOutItems';\n\nconst MobileLoggedOutItemsSlot = ({\n items,\n}) => (\n <PluginSlot\n id=\"org.openedx.frontend.layout.header_mobile_logged_out_items.v1\"\n idAliases={['mobile_logged_out_items_slot']}\n slotOptions={{\n mergeProps: true,\n }}\n >\n <MobileLoggedOutItems items={items} />\n </PluginSlot>\n);\n\nMobileLoggedOutItemsSlot.propTypes = {\n items: mobileHeaderLoggedOutItemsDataShape,\n};\n\nexport default MobileLoggedOutItemsSlot;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,oCAAoC;AAC/D,OAAOC,oBAAoB,IAAIC,mCAAmC,QAAQ,0CAA0C;AAEpH,IAAMC,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAAAC,IAAA;EAAA,IAC5BC,KAAK,GAAAD,IAAA,CAALC,KAAK;EAAA,oBAELN,KAAA,CAAAO,aAAA,CAACN,UAAU;IACTO,EAAE,EAAC,+DAA+D;IAClEC,SAAS,EAAE,CAAC,8BAA8B,CAAE;IAC5CC,WAAW,EAAE;MACXC,UAAU,EAAE;IACd;EAAE,gBAEFX,KAAA,CAAAO,aAAA,CAACL,oBAAoB;IAACI,KAAK,EAAEA;EAAM,CAAE,CAC3B,CAAC;AAAA,CACd;AAEDF,wBAAwB,CAACQ,SAAS,GAAG;EACnCN,KAAK,EAAEH;AACT,CAAC;AAED,eAAeC,wBAAwB","ignoreList":[]}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# Mobile Main Menu Slot
|
|
2
|
+
|
|
3
|
+
### Slot ID: `org.openedx.frontend.layout.header_mobile_main_menu.v1`
|
|
4
|
+
|
|
5
|
+
### Slot ID Aliases
|
|
6
|
+
* `mobile_main_menu_slot`
|
|
7
|
+
|
|
8
|
+
## Description
|
|
9
|
+
|
|
10
|
+
This slot is used to replace/modify/hide the mobile main menu.
|
|
11
|
+
|
|
12
|
+
## Examples
|
|
13
|
+
|
|
14
|
+
### Modify Items
|
|
15
|
+
|
|
16
|
+
#### Replace All Items
|
|
17
|
+
|
|
18
|
+
The following `env.config.jsx` will replace all items in the mobile main menu.
|
|
19
|
+
|
|
20
|
+

|
|
21
|
+
|
|
22
|
+
```jsx
|
|
23
|
+
import { PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
24
|
+
|
|
25
|
+
const modifyMainMenu = ( widget ) => {
|
|
26
|
+
widget.content.menu = [
|
|
27
|
+
{
|
|
28
|
+
type: 'item',
|
|
29
|
+
href: 'https://openedx.org/',
|
|
30
|
+
content: 'openedx.org',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: 'item',
|
|
34
|
+
href: 'https://docs.openedx.org/en/latest/',
|
|
35
|
+
content: 'Documentation',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: 'item',
|
|
39
|
+
href: 'https://discuss.openedx.org/',
|
|
40
|
+
content: 'Forums',
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
return widget;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const config = {
|
|
47
|
+
pluginSlots: {
|
|
48
|
+
'org.openedx.frontend.layout.header_mobile_main_menu.v1': {
|
|
49
|
+
keepDefault: true,
|
|
50
|
+
plugins: [
|
|
51
|
+
{
|
|
52
|
+
op: PLUGIN_OPERATIONS.Modify,
|
|
53
|
+
widgetId: 'default_contents',
|
|
54
|
+
fn: modifyMainMenu,
|
|
55
|
+
},
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default config;
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### Add Items
|
|
65
|
+
|
|
66
|
+
The following `env.config.jsx` will add items in the mobile main menu.
|
|
67
|
+
|
|
68
|
+

|
|
69
|
+
|
|
70
|
+
```jsx
|
|
71
|
+
import { PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
72
|
+
|
|
73
|
+
const modifyMainMenu = (widget) => {
|
|
74
|
+
const existingMenu = widget.RenderWidget.props.menu || [];
|
|
75
|
+
|
|
76
|
+
const newMarketingLinks = [
|
|
77
|
+
{
|
|
78
|
+
type: 'item',
|
|
79
|
+
href: 'https://example.com/how-it-works',
|
|
80
|
+
content: 'How it works',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
type: 'item',
|
|
84
|
+
href: 'https://example.com/courses',
|
|
85
|
+
content: 'Courses',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
type: 'item',
|
|
89
|
+
href: 'https://example.com/schools',
|
|
90
|
+
content: 'Schools',
|
|
91
|
+
}
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
widget.content.menu = [...existingMenu, ...newMarketingLinks];
|
|
95
|
+
return widget;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const config = {
|
|
99
|
+
pluginSlots: {
|
|
100
|
+
'org.openedx.frontend.layout.header_mobile_main_menu.v1': {
|
|
101
|
+
keepDefault: true,
|
|
102
|
+
plugins: [
|
|
103
|
+
{
|
|
104
|
+
op: PLUGIN_OPERATIONS.Modify,
|
|
105
|
+
widgetId: 'default_contents',
|
|
106
|
+
fn: modifyMainMenu,
|
|
107
|
+
},
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export default config;
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Replace Menu with Custom Component
|
|
117
|
+
|
|
118
|
+
The following `env.config.jsx` will replace the mobile main menu entirely (in this case with a centered πΊοΈ `h1`)
|
|
119
|
+
|
|
120
|
+

|
|
121
|
+
|
|
122
|
+
```jsx
|
|
123
|
+
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
124
|
+
|
|
125
|
+
const config = {
|
|
126
|
+
pluginSlots: {
|
|
127
|
+
'org.openedx.frontend.layout.header_mobile_main_menu.v1': {
|
|
128
|
+
keepDefault: false,
|
|
129
|
+
plugins: [
|
|
130
|
+
{
|
|
131
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
132
|
+
widget: {
|
|
133
|
+
id: 'custom_main_menu_component',
|
|
134
|
+
type: DIRECT_PLUGIN,
|
|
135
|
+
RenderWidget: () => (
|
|
136
|
+
<h1 style={{textAlign: 'center'}}>πΊοΈ</h1>
|
|
137
|
+
),
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export default config;
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Add Custom Components before and after Menu
|
|
149
|
+
|
|
150
|
+
The following `env.config.jsx` will place custom components before and after the mobile main menu (in this case centered `h1`s with π and π).
|
|
151
|
+
|
|
152
|
+

|
|
153
|
+
|
|
154
|
+
```jsx
|
|
155
|
+
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
156
|
+
|
|
157
|
+
const config = {
|
|
158
|
+
pluginSlots: {
|
|
159
|
+
'org.openedx.frontend.layout.header_mobile_main_menu.v1': {
|
|
160
|
+
keepDefault: true,
|
|
161
|
+
plugins: [
|
|
162
|
+
{
|
|
163
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
164
|
+
widget: {
|
|
165
|
+
id: 'custom_before_main_menu_component',
|
|
166
|
+
type: DIRECT_PLUGIN,
|
|
167
|
+
priority: 10,
|
|
168
|
+
RenderWidget: () => (
|
|
169
|
+
<h1 style={{textAlign: 'center'}}>π</h1>
|
|
170
|
+
),
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
175
|
+
widget: {
|
|
176
|
+
id: 'custom_after_main_menu_component',
|
|
177
|
+
type: DIRECT_PLUGIN,
|
|
178
|
+
priority: 90,
|
|
179
|
+
RenderWidget: () => (
|
|
180
|
+
<h1 style={{textAlign: 'center'}}>π</h1>
|
|
181
|
+
),
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export default config;
|
|
190
|
+
```
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PluginSlot } from '@openedx/frontend-plugin-framework';
|
|
3
|
+
import MobileHeaderMainMenu, { mobileHeaderMainMenuDataShape } from '../../mobile-header/MobileHeaderMainMenu';
|
|
4
|
+
var MobileMainMenuSlot = function MobileMainMenuSlot(_ref) {
|
|
5
|
+
var menu = _ref.menu;
|
|
6
|
+
return /*#__PURE__*/React.createElement(PluginSlot, {
|
|
7
|
+
id: "org.openedx.frontend.layout.header_mobile_main_menu.v1",
|
|
8
|
+
idAliases: ['mobile_main_menu_slot'],
|
|
9
|
+
slotOptions: {
|
|
10
|
+
mergeProps: true
|
|
11
|
+
}
|
|
12
|
+
}, /*#__PURE__*/React.createElement(MobileHeaderMainMenu, {
|
|
13
|
+
menu: menu
|
|
14
|
+
}));
|
|
15
|
+
};
|
|
16
|
+
MobileMainMenuSlot.propTypes = {
|
|
17
|
+
menu: mobileHeaderMainMenuDataShape
|
|
18
|
+
};
|
|
19
|
+
export default MobileMainMenuSlot;
|
|
20
|
+
//# sourceMappingURL=index.js.map
|