Skip to content

Commit

Permalink
chore: fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
lpm0073 committed Nov 19, 2024
2 parents 3b2a2bf + 36d0136 commit 0cbf281
Show file tree
Hide file tree
Showing 29 changed files with 9,751 additions and 18,542 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// eslint-disable-next-line import/no-extraneous-dependencies
const { createConfig } = require('@edx/frontend-build');
const { createConfig } = require('@openedx/frontend-build');

module.exports = createConfig('eslint');
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Release CI
on:
push:
branches:
- master
- redwood/indigo
jobs:
release:
name: Release
Expand Down Expand Up @@ -38,4 +38,4 @@ jobs:
semantic_version: 16
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ module.config.js
.idea/

.vscode
src/i18n/messages
27 changes: 0 additions & 27 deletions .releaserc

This file was deleted.

9 changes: 0 additions & 9 deletions .tx/config

This file was deleted.

22 changes: 4 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
export TRANSIFEX_RESOURCE = frontend-component-header
transifex_langs = "ar,fr,es_419,zh_CN,pt,it,de,uk,ru,hi,fr_CA"

transifex_utils = ./node_modules/.bin/transifex-utils.js
i18n = ./src/i18n
transifex_input = $(i18n)/transifex_input.json

# This directory must match .babelrc .
transifex_temp = ./temp/babel-plugin-formatjs

publish:
npm run build
npm publish

build:
rm -rf ./dist
./node_modules/.bin/fedx-scripts babel src --out-dir dist --source-maps --ignore **/*.test.jsx,**/__mocks__,**/__snapshots__,**/setupTest.js --copy-files
Expand Down Expand Up @@ -35,21 +36,6 @@ detect_changed_source_translations:
# Checking for changed translations...
git diff --exit-code $(i18n)

# Pushes translations to Transifex. You must run make extract_translations first.
push_translations:
# Pushing strings to Transifex...
tx push -s
# Fetching hashes from Transifex...
./node_modules/@edx/reactifex/bash_scripts/get_hashed_strings_v3.sh
# Writing out comments to file...
$(transifex_utils) $(transifex_temp) --comments --v3-scripts-path
# Pushing comments to Transifex...
./node_modules/@edx/reactifex/bash_scripts/put_comments_v3.sh

# Pulls translations from Transifex.
pull_translations:
tx pull -t -f --mode reviewed --languages=$(transifex_langs)

# This target is used by Travis.
validate-no-uncommitted-package-lock-changes:
# Checking for package-lock.json changes...
Expand Down
7 changes: 7 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ frontend-component-header

|license| |Build Status| |Codecov| |npm_version| |npm_downloads| |semantic-release|


This is a fork of `edly-io/frontend-component-header <https://github.com/edly-io/frontend-component-header>`_, itself a fork of `openedx/frontend-component-header <https://github.com/openedx/frontend-component-header>`_.
Currently the sole reason for this fork is to insert a CSS hook into the DOM, facilitating real-time customizations to the appearance of the "Learning" MFE.

This is a ReactJS component that forms part of the `openedx/frontend-platform <https://github.com/openedx/frontend-platform>`_. The package is published to `@stepwisemath/frontend-component-header <https://www.npmjs.com/package/@stepwisemath/frontend-component-header>`_ and
is added to the Stepwise Math mfe build via `StepwiseMath/tutor-indigo-stepwisemath <https://github.com/StepwiseMath/tutor-indigo-stepwisemath>`_.

********
Purpose
********
Expand Down
Binary file added docs/images/desktop_header.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 docs/images/mobile_main_menu.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 docs/images/mobile_user_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
111 changes: 111 additions & 0 deletions docs/using_custom_header.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
.. title:: Custom Header Component Documentation

Custom Header Component
=======================

Overview
--------

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

Props Details
-------------

The `Header` component accepts the following **optional** props for customization:

``mainMenuItems``
*****************

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.
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.

Example:
::

[
{ type: 'item', href: '/courses', content: 'Courses', isActive: true },
{ type: 'item', href: '/programs', content: 'Programs' },
{ type: 'item', href: '/discover', content: 'Discover New', disabled, true },
{
type: 'submenu',
content: 'Sub Menu Item',
submenuContent: (
<>
<div className="mb-1"><a rel="noopener" href="#">Submenu item 1</a></div>
<div className="mb-1"><a rel="noopener" href="#">Submenu item 2</a></div>
</>
),
},
]

**Submenu Implementation**

To implement a submenu, set the type to ``submenu`` and provide a ``submenuContent`` property.
The submenuContent should be a React component (as shown in above example) that can be rendered.

**Note:**

- The ``type`` should be ``item`` or ``submenu``. If type is ``submenu``, it should contain ``submenuContent`` instead of ``href``.

- If any item is to be disabled, we can pass optional ``disabled: true`` in that item object and

- If any item is to be active, we can pass optional ``isActive: true`` in that item object

secondaryMenuItems
******************

The secondary menu items has same structure as ``mainMenuItems``. On desktop screen, these items are displayed on the right of header just before the userMenu avatar and on mobile screen,
these items are displayed below the mainMenu items in dropdown.

Example:
::

[
{ type: 'item', href: '/help', content: 'Help' },
]

userMenuItems
*************

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.
On mobile screens, the user menu is also displayed as a dropdown menu, appearing under the avatar icon.

Each object represents a group in the user menu. Each object contains the ``heading`` and
list of menu items to be displayed in that group. Heading is optional and will be displayed only if passed. There can
be multiple groups. For a normal user menu, a single group can be passed with empty heading.

Example:
::

[
{
heading: '',
items: [
{ type: 'item', href: '/profile', content: 'Profile' },
{ type: 'item', href: '/logout', content: 'Logout' }
]
},
]

Screenshots
***********

Desktop:

.. image:: ./images/desktop_header.png

Mobile:

.. image:: ./images/mobile_main_menu.png
.. image:: ./images/mobile_user_menu.png

Some Important Notes
--------------------

- Intl formatted strings should be passed in content attribute.
- Only menu items in the main menu can be disabled.
- Menu items in the main menu and user menu can have ``isActive`` prop.
Loading

0 comments on commit 0cbf281

Please sign in to comment.