-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e3948a
commit 1642a6e
Showing
18 changed files
with
253 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
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,4 @@ | ||
# `frontend-component-header-edx` Plugin Slots | ||
|
||
* [`header_user_menu_group_slot`](./UserMenuGroupSlot/) | ||
* [`header_user_menu_group_item_slot`](./UserMenuGroupItemSlot/) |
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,72 @@ | ||
# Header User Menu Group Slot | ||
|
||
### Slot ID: `header_user_menu_group_item_slot` | ||
|
||
## Description | ||
|
||
This slot allows you to insert a user menu item into a group within the header's user menu for both desktop and mobile screens. | ||
|
||
Note: Ensure the slot is provided with appropriate JSX that can render smoothly on both desktop and mobile screens. | ||
|
||
## Example | ||
|
||
The following ``env.config.jsx`` demonstrates how to insert a user menu item into a group within the header's user menu | ||
for both desktop and mobile screens. | ||
|
||
**Default Behaviour:** | ||
|
||
Desktop: | ||
 | ||
|
||
Mobile: | ||
 | ||
|
||
**Inserted a user menu group:** | ||
|
||
Desktop: | ||
 | ||
|
||
Mobile: | ||
 | ||
|
||
```jsx | ||
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework'; | ||
import { breakpoints, Dropdown, useWindowSize } from '@openedx/paragon'; | ||
|
||
const config = { | ||
pluginSlots: { | ||
header_user_menu_group_slot: { | ||
plugins: [ | ||
{ | ||
// Insert some user menu group item | ||
op: PLUGIN_OPERATIONS.Insert, | ||
widget: { | ||
id: 'user_menu_group', | ||
type: DIRECT_PLUGIN, | ||
RenderWidget: () => { | ||
const { width } = useWindowSize(); | ||
const isMobile = width <= breakpoints.small.maxWidth; | ||
if (!isMobile) { | ||
return ( | ||
<Dropdown.Item as="a" href="#"> | ||
User Menu Group Item | ||
</Dropdown.Item> | ||
); | ||
} | ||
return ( | ||
<li className="nav-item"> | ||
<a href="#" className="nav-link"> | ||
User Menu Group Item | ||
</a> | ||
</li> | ||
); | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
} | ||
|
||
export default config; | ||
``` |
Binary file added
BIN
+97.7 KB
src/plugin-slots/UserMenuGroupItemSlot/images/default_user_menu_desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+69 KB
src/plugin-slots/UserMenuGroupItemSlot/images/default_user_menu_mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+84.9 KB
src/plugin-slots/UserMenuGroupItemSlot/images/inserted_user_menu_item_desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+85.6 KB
src/plugin-slots/UserMenuGroupItemSlot/images/inserted_user_menu_item_mobile.png
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'; | ||
|
||
const UserMenuGroupItemSlot = () => ( | ||
<PluginSlot | ||
id="header_user_menu_group_item_slot" | ||
/> | ||
); | ||
|
||
export default UserMenuGroupItemSlot; |
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,86 @@ | ||
# Header User Menu Group Slot | ||
|
||
### Slot ID: `header_user_menu_group_slot` | ||
|
||
## Description | ||
|
||
This slot is used to insert a user menu group in the header's user menu for both desktop and mobile screens. | ||
|
||
Note: Ensure the slot is provided with appropriate JSX that can render smoothly on both desktop and mobile screens. | ||
|
||
## Example | ||
|
||
The following ``env.config.jsx`` demonstrates how to insert a user menu group into the header's user menu | ||
for both mobile and desktop screens. | ||
|
||
**Default Behaviour:** | ||
|
||
Desktop: | ||
 | ||
|
||
Mobile: | ||
 | ||
|
||
**Inserted a user menu group:** | ||
|
||
Desktop: | ||
 | ||
|
||
Mobile: | ||
 | ||
|
||
```jsx | ||
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework'; | ||
import { breakpoints, Dropdown, useWindowSize } from '@openedx/paragon'; | ||
|
||
const config = { | ||
pluginSlots: { | ||
header_user_menu_group_slot: { | ||
plugins: [ | ||
{ | ||
// Insert some user menu group | ||
op: PLUGIN_OPERATIONS.Insert, | ||
widget: { | ||
id: 'user_menu_group', | ||
type: DIRECT_PLUGIN, | ||
RenderWidget: () => { | ||
const { width } = useWindowSize(); | ||
const isMobile = width <= breakpoints.small.maxWidth; | ||
if (!isMobile) { | ||
return ( | ||
<> | ||
<Dropdown.Header>User Menu Group Header</Dropdown.Header> | ||
<Dropdown.Item as="a" href="#" className="active"> | ||
User Menu Group Item - Active | ||
</Dropdown.Item> | ||
<Dropdown.Item as="a" href="#"> | ||
User Menu Group Item 2 | ||
</Dropdown.Item> | ||
<Dropdown.Divider /> | ||
</> | ||
); | ||
} | ||
return ( | ||
<> | ||
<li className="nav-item"> | ||
<a href="#" className="nav-link active"> | ||
User Menu Group Item - Active | ||
</a> | ||
</li> | ||
<li className="nav-item"> | ||
<a href="#" className="nav-link active"> | ||
User Menu Group Item 2 | ||
</a> | ||
</li> | ||
</> | ||
); | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
} | ||
|
||
export default config; | ||
``` |
Binary file added
BIN
+97.7 KB
src/plugin-slots/UserMenuGroupSlot/images/default_user_menu_desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+66.8 KB
src/plugin-slots/UserMenuGroupSlot/images/default_user_menu_mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+109 KB
src/plugin-slots/UserMenuGroupSlot/images/inserted_user_menu_desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+86.4 KB
src/plugin-slots/UserMenuGroupSlot/images/inserted_user_menu_mobile.png
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'; | ||
|
||
const UserMenuGroupSlot = () => ( | ||
<PluginSlot | ||
id="header_user_menu_group_slot" | ||
/> | ||
); | ||
|
||
export default UserMenuGroupSlot; |