Skip to content

Commit e6aa4be

Browse files
fix: update docs
1 parent f2c236c commit e6aa4be

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

docs/using_custom_header.rst

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Overview
88

99
The ``Header`` component is used to display a header with a provided ``mainMenuItems``,
1010
``secondaryMenuItems``, and ``userMenuItems`` props. If props are provided, the component will use them; otherwise,
11-
If any of the props ``(mainMenuItems, secondaryMenuItems, userMenuItems)`` are not provided, default
12-
items are displayed. This component provides flexibility in customization, making it suitable for a wide
11+
if any of the props ``(mainMenuItems, secondaryMenuItems, userMenuItems)`` are not provided, default
12+
items will be displayed. This component provides flexibility in customization, making it suitable for a wide
1313
range of applications.
1414

1515
Props Details
@@ -20,7 +20,7 @@ The `Header` component accepts the following **optional** props for customizatio
2020
``mainMenuItems``
2121
*****************
2222

23-
The main menu items is a list of menu items objects. On desktop screens, these items are displayed on the left, to the right of the logo icon and to the left of the secondary menu.
23+
The main menu items is a list of menu items objects. On desktop screens, these items are displayed on the left side next to the logo icon.
2424
On mobile screens, the main menu is displayed as a dropdown menu triggered by a hamburger icon. The main menu dropdown appears below the logo when opened.
2525

2626
Example:
@@ -33,13 +33,20 @@ Example:
3333
{
3434
type: 'submenu',
3535
content: 'Sub Menu Item',
36-
submenuContent: [
37-
'<div className="mb-1"><a rel="noopener" href="#">Submenu item 1</a></div>',
38-
'<div className="mb-1"><a rel="noopener" href="#">Submenu item 2</a></div>'
39-
],
36+
submenuContent: (
37+
<>
38+
<div className="mb-1"><a rel="noopener" href="#">Submenu item 1</a></div>
39+
<div className="mb-1"><a rel="noopener" href="#">Submenu item 2</a></div>
40+
</>
41+
),
4042
},
4143
]
4244

45+
**Submenu Implementation**
46+
47+
To implement a submenu, set the type to ``submenu`` and provide a ``submenuContent`` property.
48+
The submenuContent should be a React component (as shown in above example) that can be rendered.
49+
4350
**Note:**
4451

4552
- The ``type`` should be ``item`` or ``submenu``. If type is ``submenu``, it should contain ``submenuContent`` instead of ``href``.
@@ -67,9 +74,9 @@ userMenuItems
6774
The user menu items is list of objects. On desktop screens, these items are displayed as a dropdown menu on the most right side of the header. The dropdown is opened by clicking on the avatar icon, which is typically located at the far right of the header.
6875
On mobile screens, the user menu is also displayed as a dropdown menu, appearing under the avatar icon.
6976

70-
User Menu is list of objects. Each object represent a group in user menu. Each object contains the ``heading`` and
77+
Each object represents a group in the user menu. Each object contains the ``heading`` and
7178
list of menu items to be displayed in that group. Heading is optional and will be displayed only if passed. There can
72-
be multiple groups. For a normal user menu, we can pass single group with empty heading.
79+
be multiple groups. For a normal user menu, a single group can be passed with empty heading.
7380

7481
Example:
7582
::

src/Header.jsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ subscribe(APP_CONFIG_INITIALIZED, () => {
3939
* For more details on how to use this component, please refer to this document:
4040
* https://github.com/openedx/frontend-component-header/blob/master/docs/using_custom_header.rst
4141
*
42-
* @param mainMenuItems
43-
* @param secondaryMenuItems
44-
* @param userMenuItems
42+
* @param {list} mainMenuItems - The list of main menu items to display.
43+
* See the documentation for the structure of main menu item.
44+
* @param {list} secondaryMenuItems - The list of secondary menu items to display.
45+
* See the documentation for the structure of secondary menu item.
46+
* @param {list} userMenuItems - The list of user menu items to display.
47+
* See the documentation for the structure of user menu item.
4548
*/
4649
const Header = ({
4750
intl, mainMenuItems, secondaryMenuItems, userMenuItems,

0 commit comments

Comments
 (0)