@nauedu/frontend-component-header 20.1.0 β 20.1.2
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/dist/Header.js +13 -9
- package/dist/Header.js.map +1 -1
- package/dist/Header.test.jsx +3 -0
- package/dist/Icons.js +1 -1
- package/dist/LanguageSelector/data/api.js +13 -5
- package/dist/LanguageSelector/data/api.js.map +1 -1
- package/dist/LanguageSelector/index.js +12 -4
- package/dist/LanguageSelector/index.js.map +1 -1
- package/dist/Logo.js +10 -23
- package/dist/Logo.js.map +1 -1
- package/dist/Menu/Menu.js +11 -11
- package/dist/Menu/Menu.js.map +1 -1
- package/dist/Menu/menu.scss +6 -6
- package/dist/__snapshots__/Header.test.jsx.snap +2 -0
- package/dist/desktop-header/DesktopHeader.js +172 -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/index.scss +34 -16
- package/dist/learning-header/AnonymousUserMenu.js +11 -8
- package/dist/learning-header/AnonymousUserMenu.js.map +1 -1
- package/dist/learning-header/AuthenticatedUserDropdown.js +32 -24
- package/dist/learning-header/AuthenticatedUserDropdown.js.map +1 -1
- package/dist/learning-header/LearningHeader.js +17 -15
- package/dist/learning-header/LearningHeader.js.map +1 -1
- 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/data/api.js +12 -4
- package/dist/learning-header/data/api.js.map +1 -1
- package/dist/learning-header/data/api.test.js +92 -95
- package/dist/learning-header/data/api.test.js.map +1 -1
- package/dist/learning-header/messages.js +5 -0
- package/dist/learning-header/messages.js.map +1 -1
- package/dist/mobile-header/MobileHeader.js +197 -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 +137 -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_modify_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 +136 -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_modify_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 +0 -2
- 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 +56 -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 +8 -10
- package/dist/studio-header/StudioHeader.test.tsx +220 -0
- package/dist/studio-header/StudioHeader.tsx +84 -0
- package/dist/studio-header/UserMenu.tsx +69 -0
- package/dist/studio-header/{index.js β index.ts} +1 -1
- package/dist/studio-header/{messages.js β messages.ts} +15 -14
- package/dist/studio-header/utils.ts +37 -0
- package/dist/test-utils.js +12 -4
- package/dist/test-utils.js.map +1 -1
- package/package.json +1 -1
- package/dist/DesktopHeader.js +0 -242
- package/dist/DesktopHeader.js.map +0 -1
- package/dist/MobileHeader.js +0 -244
- package/dist/MobileHeader.js.map +0 -1
- package/dist/learning-header/_header.scss +0 -10
- package/dist/studio-header/BrandNav.js +0 -21
- package/dist/studio-header/BrandNav.js.map +0 -1
- package/dist/studio-header/CourseLockUp.js +0 -45
- package/dist/studio-header/CourseLockUp.js.map +0 -1
- package/dist/studio-header/HeaderBody.js +0 -131
- package/dist/studio-header/HeaderBody.js.map +0 -1
- package/dist/studio-header/MobileHeader.js +0 -79
- package/dist/studio-header/MobileHeader.js.map +0 -1
- package/dist/studio-header/MobileMenu.js +0 -45
- package/dist/studio-header/MobileMenu.js.map +0 -1
- package/dist/studio-header/NavDropdownMenu.js +0 -30
- package/dist/studio-header/NavDropdownMenu.js.map +0 -1
- package/dist/studio-header/StudioHeader.js +0 -72
- package/dist/studio-header/StudioHeader.js.map +0 -1
- package/dist/studio-header/UserMenu.js +0 -55
- package/dist/studio-header/UserMenu.js.map +0 -1
- package/dist/studio-header/index.js.map +0 -1
- package/dist/studio-header/messages.js.map +0 -1
- package/dist/studio-header/utils.js +0 -29
- package/dist/studio-header/utils.js.map +0 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Desktop Secondary Menu Slot
|
|
2
|
+
|
|
3
|
+
### Slot ID: `org.openedx.frontend.layout.header_desktop_secondary_menu.v1`
|
|
4
|
+
|
|
5
|
+
### Slot ID Aliases
|
|
6
|
+
* `desktop_secondary_menu_slot`
|
|
7
|
+
|
|
8
|
+
## Description
|
|
9
|
+
|
|
10
|
+
This slot is used to replace/modify/hide the desktop secondary menu.
|
|
11
|
+
|
|
12
|
+
## Examples
|
|
13
|
+
|
|
14
|
+
### Modify Items
|
|
15
|
+
|
|
16
|
+
The following `env.config.jsx` will modify the items in the desktop secondary menu.
|
|
17
|
+
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
```jsx
|
|
21
|
+
import { PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
22
|
+
|
|
23
|
+
const modifySecondaryMenu = ( widget ) => {
|
|
24
|
+
widget.content.menu = [
|
|
25
|
+
{
|
|
26
|
+
type: 'item',
|
|
27
|
+
href: 'https://www.youtube.com/c/openedx',
|
|
28
|
+
content: 'Open edX on YouTube',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'item',
|
|
32
|
+
href: 'https://github.com/openedx/',
|
|
33
|
+
content: 'Open edX on GitHub',
|
|
34
|
+
}
|
|
35
|
+
];
|
|
36
|
+
return widget;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const config = {
|
|
40
|
+
pluginSlots: {
|
|
41
|
+
'org.openedx.frontend.layout.header_desktop_secondary_menu.v1': {
|
|
42
|
+
keepDefault: true,
|
|
43
|
+
plugins: [
|
|
44
|
+
{
|
|
45
|
+
op: PLUGIN_OPERATIONS.Modify,
|
|
46
|
+
widgetId: 'default_contents',
|
|
47
|
+
fn: modifySecondaryMenu,
|
|
48
|
+
},
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default config;
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Replace Menu with Custom Component
|
|
58
|
+
|
|
59
|
+
The following `env.config.jsx` will replace the desktop secondary menu entirely (in this case with a centered πΊοΈ `h1`)
|
|
60
|
+
|
|
61
|
+

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

|
|
94
|
+
|
|
95
|
+
```jsx
|
|
96
|
+
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
97
|
+
|
|
98
|
+
const config = {
|
|
99
|
+
pluginSlots: {
|
|
100
|
+
'org.openedx.frontend.layout.header_desktop_secondary_menu.v1': {
|
|
101
|
+
keepDefault: true,
|
|
102
|
+
plugins: [
|
|
103
|
+
{
|
|
104
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
105
|
+
widget: {
|
|
106
|
+
id: 'custom_before_secondary_menu_component',
|
|
107
|
+
type: DIRECT_PLUGIN,
|
|
108
|
+
priority: 10,
|
|
109
|
+
RenderWidget: () => (
|
|
110
|
+
<h1 style={{textAlign: 'center'}}>π</h1>
|
|
111
|
+
),
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
116
|
+
widget: {
|
|
117
|
+
id: 'custom_after_secondary_menu_component',
|
|
118
|
+
type: DIRECT_PLUGIN,
|
|
119
|
+
priority: 90,
|
|
120
|
+
RenderWidget: () => (
|
|
121
|
+
<h1 style={{textAlign: 'center'}}>π</h1>
|
|
122
|
+
),
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export default config;
|
|
131
|
+
```
|
|
132
|
+
|
|
Binary file
|
|
Binary file
|
package/dist/plugin-slots/DesktopSecondaryMenuSlot/images/desktop_secondary_menu_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 DesktopHeaderMainOrSecondaryMenu, { desktopHeaderMainOrSecondaryMenuDataShape } from '../../desktop-header/DesktopHeaderMainOrSecondaryMenu';
|
|
4
|
+
var DesktopSecondaryMenuSlot = function DesktopSecondaryMenuSlot(_ref) {
|
|
5
|
+
var menu = _ref.menu;
|
|
6
|
+
return /*#__PURE__*/React.createElement(PluginSlot, {
|
|
7
|
+
id: "org.openedx.frontend.layout.header_desktop_secondary_menu.v1",
|
|
8
|
+
idAliases: ['desktop_secondary_menu_slot'],
|
|
9
|
+
slotOptions: {
|
|
10
|
+
mergeProps: true
|
|
11
|
+
}
|
|
12
|
+
}, /*#__PURE__*/React.createElement(DesktopHeaderMainOrSecondaryMenu, {
|
|
13
|
+
menu: menu
|
|
14
|
+
}));
|
|
15
|
+
};
|
|
16
|
+
DesktopSecondaryMenuSlot.propTypes = {
|
|
17
|
+
menu: desktopHeaderMainOrSecondaryMenuDataShape
|
|
18
|
+
};
|
|
19
|
+
export default DesktopSecondaryMenuSlot;
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PluginSlot","DesktopHeaderMainOrSecondaryMenu","desktopHeaderMainOrSecondaryMenuDataShape","DesktopSecondaryMenuSlot","_ref","menu","createElement","id","idAliases","slotOptions","mergeProps","propTypes"],"sources":["../../../src/plugin-slots/DesktopSecondaryMenuSlot/index.jsx"],"sourcesContent":["import React from 'react';\nimport { PluginSlot } from '@openedx/frontend-plugin-framework';\nimport DesktopHeaderMainOrSecondaryMenu, { desktopHeaderMainOrSecondaryMenuDataShape } from '../../desktop-header/DesktopHeaderMainOrSecondaryMenu';\n\nconst DesktopSecondaryMenuSlot = ({\n menu,\n}) => (\n <PluginSlot\n id=\"org.openedx.frontend.layout.header_desktop_secondary_menu.v1\"\n idAliases={['desktop_secondary_menu_slot']}\n slotOptions={{\n mergeProps: true,\n }}\n >\n <DesktopHeaderMainOrSecondaryMenu menu={menu} />\n </PluginSlot>\n);\n\nDesktopSecondaryMenuSlot.propTypes = {\n menu: desktopHeaderMainOrSecondaryMenuDataShape,\n};\n\nexport default DesktopSecondaryMenuSlot;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,oCAAoC;AAC/D,OAAOC,gCAAgC,IAAIC,yCAAyC,QAAQ,uDAAuD;AAEnJ,IAAMC,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAAAC,IAAA;EAAA,IAC5BC,IAAI,GAAAD,IAAA,CAAJC,IAAI;EAAA,oBAEJN,KAAA,CAAAO,aAAA,CAACN,UAAU;IACTO,EAAE,EAAC,8DAA8D;IACjEC,SAAS,EAAE,CAAC,6BAA6B,CAAE;IAC3CC,WAAW,EAAE;MACXC,UAAU,EAAE;IACd;EAAE,gBAEFX,KAAA,CAAAO,aAAA,CAACL,gCAAgC;IAACI,IAAI,EAAEA;EAAK,CAAE,CACrC,CAAC;AAAA,CACd;AAEDF,wBAAwB,CAACQ,SAAS,GAAG;EACnCN,IAAI,EAAEH;AACR,CAAC;AAED,eAAeC,wBAAwB","ignoreList":[]}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Desktop User Menu Slot
|
|
2
|
+
|
|
3
|
+
### Slot ID: `org.openedx.frontend.layout.header_desktop_user_menu.v1`
|
|
4
|
+
|
|
5
|
+
### Slot ID Aliases
|
|
6
|
+
* `desktop_user_menu_slot`
|
|
7
|
+
|
|
8
|
+
## Description
|
|
9
|
+
|
|
10
|
+
This slot is used to replace/modify/hide the desktop user menu.
|
|
11
|
+
|
|
12
|
+
## Examples
|
|
13
|
+
|
|
14
|
+
### Modify Items
|
|
15
|
+
|
|
16
|
+
The following `env.config.jsx` will modify the items in the desktop user menu.
|
|
17
|
+
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
```jsx
|
|
21
|
+
import { PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
22
|
+
|
|
23
|
+
const modifyUserMenu = ( widget ) => {
|
|
24
|
+
widget.content.menu = [
|
|
25
|
+
{
|
|
26
|
+
items: [
|
|
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
|
+
},
|
|
39
|
+
{
|
|
40
|
+
items: [
|
|
41
|
+
{
|
|
42
|
+
type: 'item',
|
|
43
|
+
href: 'https://discuss.openedx.org/',
|
|
44
|
+
content: 'Forums',
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
return widget;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const config = {
|
|
53
|
+
pluginSlots: {
|
|
54
|
+
'org.openedx.frontend.layout.header_desktop_user_menu.v1': {
|
|
55
|
+
keepDefault: true,
|
|
56
|
+
plugins: [
|
|
57
|
+
{
|
|
58
|
+
op: PLUGIN_OPERATIONS.Modify,
|
|
59
|
+
widgetId: 'default_contents',
|
|
60
|
+
fn: modifyUserMenu,
|
|
61
|
+
},
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export default config;
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Replace Menu with Custom Component
|
|
71
|
+
|
|
72
|
+
The following `env.config.jsx` will replace the desktop user menu entirely (in this case with a centered πΊοΈ `h1`)
|
|
73
|
+
|
|
74
|
+

|
|
75
|
+
|
|
76
|
+
```jsx
|
|
77
|
+
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
78
|
+
|
|
79
|
+
const config = {
|
|
80
|
+
pluginSlots: {
|
|
81
|
+
'org.openedx.frontend.layout.header_desktop_user_menu.v1': {
|
|
82
|
+
keepDefault: false,
|
|
83
|
+
plugins: [
|
|
84
|
+
{
|
|
85
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
86
|
+
widget: {
|
|
87
|
+
id: 'custom_user_menu_component',
|
|
88
|
+
type: DIRECT_PLUGIN,
|
|
89
|
+
RenderWidget: () => (
|
|
90
|
+
<h1 style={{textAlign: 'center'}}>πΊοΈ</h1>
|
|
91
|
+
),
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export default config;
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Add Custom Components before and after Menu
|
|
103
|
+
|
|
104
|
+
The following `env.config.jsx` will place custom components before and after the desktop user menu (in this case centered `h1`s with π and π).
|
|
105
|
+
|
|
106
|
+

|
|
107
|
+
|
|
108
|
+
```jsx
|
|
109
|
+
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
110
|
+
|
|
111
|
+
const config = {
|
|
112
|
+
pluginSlots: {
|
|
113
|
+
'org.openedx.frontend.layout.header_desktop_user_menu.v1': {
|
|
114
|
+
keepDefault: true,
|
|
115
|
+
plugins: [
|
|
116
|
+
{
|
|
117
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
118
|
+
widget: {
|
|
119
|
+
id: 'custom_before_user_menu_component',
|
|
120
|
+
type: DIRECT_PLUGIN,
|
|
121
|
+
priority: 10,
|
|
122
|
+
RenderWidget: () => (
|
|
123
|
+
<h1 style={{textAlign: 'center'}}>π</h1>
|
|
124
|
+
),
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
129
|
+
widget: {
|
|
130
|
+
id: 'custom_after_user_menu_component',
|
|
131
|
+
type: DIRECT_PLUGIN,
|
|
132
|
+
priority: 90,
|
|
133
|
+
RenderWidget: () => (
|
|
134
|
+
<h1 style={{textAlign: 'center'}}>π</h1>
|
|
135
|
+
),
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export default config;
|
|
144
|
+
```
|
|
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 DesktopHeaderUserMenu, { desktopUserMenuDataShape } from '../../desktop-header/DesktopHeaderUserMenu';
|
|
4
|
+
var DesktopUserMenuSlot = function DesktopUserMenuSlot(_ref) {
|
|
5
|
+
var menu = _ref.menu;
|
|
6
|
+
return /*#__PURE__*/React.createElement(PluginSlot, {
|
|
7
|
+
id: "org.openedx.frontend.layout.header_desktop_user_menu.v1",
|
|
8
|
+
idAliases: ['desktop_user_menu_slot'],
|
|
9
|
+
slotOptions: {
|
|
10
|
+
mergeProps: true
|
|
11
|
+
}
|
|
12
|
+
}, /*#__PURE__*/React.createElement(DesktopHeaderUserMenu, {
|
|
13
|
+
menu: menu
|
|
14
|
+
}));
|
|
15
|
+
};
|
|
16
|
+
DesktopUserMenuSlot.propTypes = {
|
|
17
|
+
menu: desktopUserMenuDataShape
|
|
18
|
+
};
|
|
19
|
+
export default DesktopUserMenuSlot;
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PluginSlot","DesktopHeaderUserMenu","desktopUserMenuDataShape","DesktopUserMenuSlot","_ref","menu","createElement","id","idAliases","slotOptions","mergeProps","propTypes"],"sources":["../../../src/plugin-slots/DesktopUserMenuSlot/index.jsx"],"sourcesContent":["import React from 'react';\nimport { PluginSlot } from '@openedx/frontend-plugin-framework';\nimport DesktopHeaderUserMenu, { desktopUserMenuDataShape } from '../../desktop-header/DesktopHeaderUserMenu';\n\nconst DesktopUserMenuSlot = ({\n menu,\n}) => (\n <PluginSlot\n id=\"org.openedx.frontend.layout.header_desktop_user_menu.v1\"\n idAliases={['desktop_user_menu_slot']}\n slotOptions={{\n mergeProps: true,\n }}\n >\n <DesktopHeaderUserMenu menu={menu} />\n </PluginSlot>\n);\n\nDesktopUserMenuSlot.propTypes = {\n menu: desktopUserMenuDataShape,\n};\n\nexport default DesktopUserMenuSlot;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,oCAAoC;AAC/D,OAAOC,qBAAqB,IAAIC,wBAAwB,QAAQ,4CAA4C;AAE5G,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAAC,IAAA;EAAA,IACvBC,IAAI,GAAAD,IAAA,CAAJC,IAAI;EAAA,oBAEJN,KAAA,CAAAO,aAAA,CAACN,UAAU;IACTO,EAAE,EAAC,yDAAyD;IAC5DC,SAAS,EAAE,CAAC,wBAAwB,CAAE;IACtCC,WAAW,EAAE;MACXC,UAAU,EAAE;IACd;EAAE,gBAEFX,KAAA,CAAAO,aAAA,CAACL,qBAAqB;IAACI,IAAI,EAAEA;EAAK,CAAE,CAC1B,CAAC;AAAA,CACd;AAEDF,mBAAmB,CAACQ,SAAS,GAAG;EAC9BN,IAAI,EAAEH;AACR,CAAC;AAED,eAAeC,mBAAmB","ignoreList":[]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Desktop User Menu Toggle Slot
|
|
2
|
+
|
|
3
|
+
### Slot ID: `org.openedx.frontend.layout.header_desktop_user_menu_toggle.v1`
|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
This slot is used to replace/modify/hide the contents of the user menu toggle button on desktop sized screens.
|
|
8
|
+
|
|
9
|
+
## Examples
|
|
10
|
+
|
|
11
|
+
### Modify Label Text
|
|
12
|
+
|
|
13
|
+
The following `env.config.jsx` will modify the label text to be something more generic:
|
|
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.label = "My Profile";
|
|
23
|
+
return widget;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const config = {
|
|
27
|
+
pluginSlots: {
|
|
28
|
+
'org.openedx.frontend.layout.header_desktop_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 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_desktop_user_menu_toggle.v1': {
|
|
56
|
+
keepDefault: false,
|
|
57
|
+
plugins: [
|
|
58
|
+
{
|
|
59
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
60
|
+
widget: {
|
|
61
|
+
id: 'custom_desktop_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
|
+
```
|
package/dist/plugin-slots/DesktopUserMenuToggleSlot/images/desktop_user_menu_custom_component.png
ADDED
|
Binary file
|
package/dist/plugin-slots/DesktopUserMenuToggleSlot/images/desktop_user_menu_modified_toggle.png
ADDED
|
Binary file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PluginSlot } from '@openedx/frontend-plugin-framework';
|
|
3
|
+
import DesktopUserMenuToggle, { DesktopUserMenuTogglePropTypes } from '../../desktop-header/DesktopUserMenuToggle';
|
|
4
|
+
var DesktopUserMenuToggleSlot = function DesktopUserMenuToggleSlot(_ref) {
|
|
5
|
+
var avatar = _ref.avatar,
|
|
6
|
+
label = _ref.label;
|
|
7
|
+
return /*#__PURE__*/React.createElement(PluginSlot, {
|
|
8
|
+
id: "org.openedx.frontend.layout.header_desktop_user_menu_toggle.v1",
|
|
9
|
+
slotOptions: {
|
|
10
|
+
mergeProps: true
|
|
11
|
+
}
|
|
12
|
+
}, /*#__PURE__*/React.createElement(DesktopUserMenuToggle, {
|
|
13
|
+
avatar: avatar,
|
|
14
|
+
label: label
|
|
15
|
+
}));
|
|
16
|
+
};
|
|
17
|
+
DesktopUserMenuToggleSlot.propTypes = DesktopUserMenuTogglePropTypes;
|
|
18
|
+
export default DesktopUserMenuToggleSlot;
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PluginSlot","DesktopUserMenuToggle","DesktopUserMenuTogglePropTypes","DesktopUserMenuToggleSlot","_ref","avatar","label","createElement","id","slotOptions","mergeProps","propTypes"],"sources":["../../../src/plugin-slots/DesktopUserMenuToggleSlot/index.jsx"],"sourcesContent":["import React from 'react';\nimport { PluginSlot } from '@openedx/frontend-plugin-framework';\nimport DesktopUserMenuToggle, { DesktopUserMenuTogglePropTypes } from '../../desktop-header/DesktopUserMenuToggle';\n\nconst DesktopUserMenuToggleSlot = ({\n avatar,\n label,\n}) => (\n <PluginSlot\n id=\"org.openedx.frontend.layout.header_desktop_user_menu_toggle.v1\"\n slotOptions={{\n mergeProps: true,\n }}\n >\n <DesktopUserMenuToggle avatar={avatar} label={label} />\n </PluginSlot>\n);\n\nDesktopUserMenuToggleSlot.propTypes = DesktopUserMenuTogglePropTypes;\n\nexport default DesktopUserMenuToggleSlot;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,oCAAoC;AAC/D,OAAOC,qBAAqB,IAAIC,8BAA8B,QAAQ,4CAA4C;AAElH,IAAMC,yBAAyB,GAAG,SAA5BA,yBAAyBA,CAAAC,IAAA;EAAA,IAC7BC,MAAM,GAAAD,IAAA,CAANC,MAAM;IACNC,KAAK,GAAAF,IAAA,CAALE,KAAK;EAAA,oBAELP,KAAA,CAAAQ,aAAA,CAACP,UAAU;IACTQ,EAAE,EAAC,gEAAgE;IACnEC,WAAW,EAAE;MACXC,UAAU,EAAE;IACd;EAAE,gBAEFX,KAAA,CAAAQ,aAAA,CAACN,qBAAqB;IAACI,MAAM,EAAEA,MAAO;IAACC,KAAK,EAAEA;EAAM,CAAE,CAC5C,CAAC;AAAA,CACd;AAEDH,yBAAyB,CAACQ,SAAS,GAAGT,8BAA8B;AAEpE,eAAeC,yBAAyB","ignoreList":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Learning Help Slot
|
|
2
|
+
|
|
3
|
+
### Slot ID: `org.openedx.frontend.layout.header_learning_help.v1`
|
|
4
|
+
|
|
5
|
+
### Slot ID Aliases
|
|
6
|
+
* `learning_help_slot`
|
|
7
|
+
|
|
8
|
+
## Description
|
|
9
|
+
|
|
10
|
+
This slot is used to replace/modify/hide the learning help link.
|
|
11
|
+
|
|
12
|
+
## Examples
|
|
13
|
+
|
|
14
|
+
### Custom Component
|
|
15
|
+
|
|
16
|
+
The following `env.config.jsx` will replace the help link 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_learning_help.v1': {
|
|
26
|
+
keepDefault: false,
|
|
27
|
+
plugins: [
|
|
28
|
+
{
|
|
29
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
30
|
+
widget: {
|
|
31
|
+
id: 'custom_learning_help_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,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PluginSlot } from '@openedx/frontend-plugin-framework';
|
|
3
|
+
import LearningHeaderHelpLink from '../../learning-header/LearningHeaderHelpLink';
|
|
4
|
+
var LearningHelpSlot = function LearningHelpSlot() {
|
|
5
|
+
return /*#__PURE__*/React.createElement(PluginSlot, {
|
|
6
|
+
id: "org.openedx.frontend.layout.header_learning_help.v1",
|
|
7
|
+
idAliases: ['learning_help_slot']
|
|
8
|
+
}, /*#__PURE__*/React.createElement(LearningHeaderHelpLink, null));
|
|
9
|
+
};
|
|
10
|
+
export default LearningHelpSlot;
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PluginSlot","LearningHeaderHelpLink","LearningHelpSlot","createElement","id","idAliases"],"sources":["../../../src/plugin-slots/LearningHelpSlot/index.jsx"],"sourcesContent":["import React from 'react';\nimport { PluginSlot } from '@openedx/frontend-plugin-framework';\nimport LearningHeaderHelpLink from '../../learning-header/LearningHeaderHelpLink';\n\nconst LearningHelpSlot = () => (\n <PluginSlot id=\"org.openedx.frontend.layout.header_learning_help.v1\" idAliases={['learning_help_slot']}>\n <LearningHeaderHelpLink />\n </PluginSlot>\n);\n\nexport default LearningHelpSlot;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,oCAAoC;AAC/D,OAAOC,sBAAsB,MAAM,8CAA8C;AAEjF,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAA;EAAA,oBACpBH,KAAA,CAAAI,aAAA,CAACH,UAAU;IAACI,EAAE,EAAC,qDAAqD;IAACC,SAAS,EAAE,CAAC,oBAAoB;EAAE,gBACrGN,KAAA,CAAAI,aAAA,CAACF,sBAAsB,MAAE,CACf,CAAC;AAAA,CACd;AAED,eAAeC,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Learning Logged Out Items Slot
|
|
2
|
+
|
|
3
|
+
### Slot ID: `org.openedx.frontend.layout.header_learning_logged_out_items.v1`
|
|
4
|
+
|
|
5
|
+
### Slot ID Aliases
|
|
6
|
+
* `learning_logged_out_items_slot`
|
|
7
|
+
|
|
8
|
+
## Description
|
|
9
|
+
|
|
10
|
+
This slot is used to replace/modify/hide the items shown on the learning header when the user is logged out.
|
|
11
|
+
|
|
12
|
+
## Examples
|
|
13
|
+
|
|
14
|
+
### Modify Items
|
|
15
|
+
|
|
16
|
+
The following `env.config.jsx` will modify the items shown on the learning header when the user is logged out.
|
|
17
|
+
|
|
18
|
+

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

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

|
|
97
|
+
|
|
98
|
+
```jsx
|
|
99
|
+
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
100
|
+
|
|
101
|
+
const config = {
|
|
102
|
+
pluginSlots: {
|
|
103
|
+
'org.openedx.frontend.layout.header_learning_logged_out_items.v1': {
|
|
104
|
+
keepDefault: true,
|
|
105
|
+
plugins: [
|
|
106
|
+
{
|
|
107
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
108
|
+
widget: {
|
|
109
|
+
id: 'custom_before_logged_out_items_component',
|
|
110
|
+
type: DIRECT_PLUGIN,
|
|
111
|
+
priority: 10,
|
|
112
|
+
RenderWidget: () => (
|
|
113
|
+
<h1 style={{textAlign: 'center'}}>π</h1>
|
|
114
|
+
),
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
op: PLUGIN_OPERATIONS.Insert,
|
|
119
|
+
widget: {
|
|
120
|
+
id: 'custom_after_logged_out_items_component',
|
|
121
|
+
type: DIRECT_PLUGIN,
|
|
122
|
+
priority: 90,
|
|
123
|
+
RenderWidget: () => (
|
|
124
|
+
<h1 style={{textAlign: 'center'}}>π</h1>
|
|
125
|
+
),
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export default config;
|
|
134
|
+
```
|
|
135
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PluginSlot } from '@openedx/frontend-plugin-framework';
|
|
3
|
+
import LearningLoggedOutButtons, { learningHeaderLoggedOutItemsDataShape } from '../../learning-header/LearningLoggedOutButtons';
|
|
4
|
+
var LearningLoggedOutItemsSlot = function LearningLoggedOutItemsSlot(_ref) {
|
|
5
|
+
var buttonsInfo = _ref.buttonsInfo;
|
|
6
|
+
return /*#__PURE__*/React.createElement(PluginSlot, {
|
|
7
|
+
id: "org.openedx.frontend.layout.header_learning_logged_out_items.v1",
|
|
8
|
+
idAliases: ['learning_logged_out_items_slot'],
|
|
9
|
+
slotOptions: {
|
|
10
|
+
mergeProps: true
|
|
11
|
+
}
|
|
12
|
+
}, /*#__PURE__*/React.createElement(LearningLoggedOutButtons, {
|
|
13
|
+
buttonsInfo: buttonsInfo
|
|
14
|
+
}));
|
|
15
|
+
};
|
|
16
|
+
LearningLoggedOutItemsSlot.propTypes = learningHeaderLoggedOutItemsDataShape;
|
|
17
|
+
export default LearningLoggedOutItemsSlot;
|
|
18
|
+
//# sourceMappingURL=index.js.map
|