Compare commits
90 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8213ee7460 | ||
|
|
8a7d6eecdf | ||
|
|
a2497eeb22 | ||
|
|
a703abad76 | ||
|
|
3f4d987d12 | ||
|
|
45e551ea44 | ||
|
|
a0d7fd7cf2 | ||
|
|
97d1bdedfb | ||
|
|
4351a09c9f | ||
|
|
9647a74507 | ||
|
|
9cef77349f | ||
|
|
ad7c42bcf9 | ||
|
|
266386fe24 | ||
|
|
f42ee37e16 | ||
|
|
354f9fdc38 | ||
|
|
85b07acfb5 | ||
|
|
3e647f7394 | ||
|
|
848b0f37b9 | ||
|
|
818b3800aa | ||
|
|
63e47bc45a | ||
|
|
7ba5371f69 | ||
|
|
9f0c286897 | ||
|
|
4cc5b91d6d | ||
|
|
3d75a72f0c | ||
|
|
0541dc194e | ||
|
|
b92127fd12 | ||
|
|
b2b9f3fa00 | ||
|
|
b9b6282b4b | ||
|
|
8606585978 | ||
|
|
159072779f | ||
|
|
de843d330d | ||
|
|
d554de89ca | ||
|
|
72be96c230 | ||
|
|
564f34a7c6 | ||
|
|
ab15b3d2bf | ||
|
|
59db41c61e | ||
|
|
0415c00353 | ||
|
|
9d01c074e0 | ||
|
|
83c5b0258f | ||
|
|
45246ad5ee | ||
|
|
487b2590bd | ||
|
|
6cab3f3f3e | ||
|
|
e3c8ec027e | ||
|
|
1e899c1c48 | ||
|
|
370b193df3 | ||
|
|
58c34abd66 | ||
|
|
c9942c1552 | ||
|
|
432dbb5e6b | ||
|
|
02748fab13 | ||
|
|
3a5506c646 | ||
|
|
10619ceb5e | ||
|
|
2694492a7c | ||
|
|
be7d0d97e4 | ||
|
|
e6aa4be4f6 | ||
|
|
f2c236c828 | ||
|
|
db912e6dae | ||
|
|
abb08be08e | ||
|
|
6c6ccc7f20 | ||
|
|
2494ad2b57 | ||
|
|
3b2a2bfa95 | ||
|
|
30b91791e3 | ||
|
|
08592aeec7 | ||
|
|
c1d143ace2 | ||
|
|
54a879aec2 | ||
|
|
b5b37f1d64 | ||
|
|
36be99ace0 | ||
|
|
222bc19bd0 | ||
|
|
3d827e64ea | ||
|
|
8a247abd6a | ||
|
|
a6943fbaeb | ||
|
|
19292cd5b6 | ||
|
|
b6374a5c05 | ||
|
|
f6a4036b49 | ||
|
|
12a845ad33 | ||
|
|
a4a7456726 | ||
|
|
6fdf73fed3 | ||
|
|
32b8079744 | ||
|
|
b9f7fe74c8 | ||
|
|
5a259a76df | ||
|
|
d2ad5ee2a4 | ||
|
|
67fefe814b | ||
|
|
9a5b1fa5e7 | ||
|
|
55f21aeeaa | ||
|
|
fc24e61a1c | ||
|
|
bace8286fd | ||
|
|
665653e9a5 | ||
|
|
0cc2282c44 | ||
|
|
455ffd345c | ||
|
|
dde02a0739 | ||
|
|
81cb72f10b |
@@ -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');
|
||||
|
||||
14
.github/workflows/ci.yml
vendored
14
.github/workflows/ci.yml
vendored
@@ -9,17 +9,18 @@ on:
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node: [18, 20]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Nodejs Env
|
||||
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV
|
||||
- name: Setup Nodejs
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VER }}
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Validate package-lock.json changes
|
||||
@@ -33,4 +34,7 @@ jobs:
|
||||
- name: i18n_extract
|
||||
run: npm run i18n_extract
|
||||
- name: Coverage
|
||||
uses: codecov/codecov-action@v3
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
fail_ci_if_error: true
|
||||
|
||||
2
.github/workflows/lockfileversion-check.yml
vendored
2
.github/workflows/lockfileversion-check.yml
vendored
@@ -10,4 +10,4 @@ on:
|
||||
|
||||
jobs:
|
||||
version-check:
|
||||
uses: openedx/.github/.github/workflows/lockfile-check.yml@master
|
||||
uses: openedx/.github/.github/workflows/lockfileversion-check-v3.yml@master
|
||||
|
||||
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
@@ -3,6 +3,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- alpha
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
@@ -15,7 +16,7 @@ jobs:
|
||||
- name: Setup Nodejs Env
|
||||
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VER }}
|
||||
- name: Install dependencies
|
||||
@@ -29,7 +30,10 @@ jobs:
|
||||
- name: i18n_extract
|
||||
run: npm run i18n_extract
|
||||
- name: Coverage
|
||||
uses: codecov/codecov-action@v3
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
fail_ci_if_error: false
|
||||
- name: Build
|
||||
run: npm run build
|
||||
- name: Release
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -9,3 +9,4 @@ module.config.js
|
||||
.idea/
|
||||
|
||||
.vscode
|
||||
src/i18n/messages
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"branch": "master",
|
||||
"branches": [
|
||||
"master",
|
||||
{name: "alpha", prerelease: true}
|
||||
],
|
||||
"tagFormat": "v${version}",
|
||||
"verifyConditions": [
|
||||
"@semantic-release/npm",
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
[main]
|
||||
host = https://www.transifex.com
|
||||
|
||||
[o:open-edx:p:edx-platform:r:frontend-component-header]
|
||||
file_filter = src/i18n/messages/<lang>.json
|
||||
source_file = src/i18n/transifex_input.json
|
||||
source_lang = en
|
||||
type = KEYVALUEJSON
|
||||
|
||||
18
Makefile
18
Makefile
@@ -1,6 +1,3 @@
|
||||
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
|
||||
@@ -35,21 +32,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...
|
||||
|
||||
@@ -95,6 +95,12 @@ This library has the following exports:
|
||||
* ``messages``: Internationalization messages suitable for use with `@edx/frontend-platform/i18n <https://edx.github.io/frontend-platform/module-Internationalization.html>`_
|
||||
* ``dist/index.scss``: A SASS file which contains style information for the component. It should be imported into the micro-frontend's own SCSS file.
|
||||
|
||||
Plugins
|
||||
-------
|
||||
This can be customized using `Frontend Plugin Framework <https://github.com/openedx/frontend-plugin-framework>`_.
|
||||
|
||||
The parts of this that can be customized in that manner are documented `here </src/plugin-slots>`_.
|
||||
|
||||
Examples
|
||||
========
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
const { createConfig } = require('@edx/frontend-build');
|
||||
const { createConfig } = require('@openedx/frontend-build');
|
||||
|
||||
module.exports = createConfig('babel-preserve-modules');
|
||||
|
||||
BIN
docs/images/desktop_header.png
Normal file
BIN
docs/images/desktop_header.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 123 KiB |
BIN
docs/images/mobile_main_menu.png
Normal file
BIN
docs/images/mobile_main_menu.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
BIN
docs/images/mobile_user_menu.png
Normal file
BIN
docs/images/mobile_user_menu.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
111
docs/using_custom_header.rst
Normal file
111
docs/using_custom_header.rst
Normal file
@@ -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.
|
||||
@@ -7,6 +7,7 @@ import { AppContext, AppProvider } from '@edx/frontend-platform/react';
|
||||
import Header from '@edx/frontend-component-header';
|
||||
|
||||
import './index.scss';
|
||||
import StudioHeader from '../src/studio-header/StudioHeader';
|
||||
|
||||
subscribe(APP_READY, () => {
|
||||
ReactDOM.render(
|
||||
@@ -32,7 +33,35 @@ subscribe(APP_READY, () => {
|
||||
}}>
|
||||
<Header />
|
||||
</AppContext.Provider>
|
||||
<h5 className="mt-2">Logged in state</h5>
|
||||
<h5 className="mt-2 mb-5">Logged in state</h5>
|
||||
<AppContext.Provider value={{
|
||||
authenticatedUser: {
|
||||
userId: '123abc',
|
||||
username: 'testuser',
|
||||
roles: [],
|
||||
administrator: false,
|
||||
},
|
||||
config: getConfig(),
|
||||
}}>
|
||||
<StudioHeader
|
||||
number="run123"
|
||||
org="testX"
|
||||
title="Course Name"
|
||||
isHiddenMainMenu={false}
|
||||
mainMenuDropdowns={[
|
||||
{
|
||||
id: 'content-dropdown',
|
||||
buttonTitle: 'Content',
|
||||
items: [{
|
||||
href: '#',
|
||||
title: 'Outline',
|
||||
}],
|
||||
},
|
||||
]}
|
||||
outlineLink="#"
|
||||
/>
|
||||
</AppContext.Provider>
|
||||
<h5 className="mt-2">Logged in state for Studio header</h5>
|
||||
</AppProvider>,
|
||||
document.getElementById('root'),
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@import "@edx/brand/paragon/fonts";
|
||||
@import "@edx/brand/paragon/variables";
|
||||
@import "@edx/paragon/scss/core/core";
|
||||
@import "@openedx/paragon/scss/core/core";
|
||||
@import "@edx/brand/paragon/overrides";
|
||||
|
||||
@import "@edx/frontend-component-header/index";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { createConfig } = require('@edx/frontend-build');
|
||||
const { createConfig } = require('@openedx/frontend-build');
|
||||
|
||||
module.exports = createConfig('jest', {
|
||||
setupFilesAfterEnv: [
|
||||
|
||||
18351
package-lock.json
generated
18351
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
27
package.json
27
package.json
@@ -35,14 +35,13 @@
|
||||
"devDependencies": {
|
||||
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
|
||||
"@edx/browserslist-config": "^1.1.1",
|
||||
"@edx/frontend-build": "13.0.4",
|
||||
"@edx/frontend-platform": "6.0.2",
|
||||
"@edx/frontend-platform": "8.1.1",
|
||||
"@edx/reactifex": "^2.1.1",
|
||||
"@testing-library/dom": "9.3.3",
|
||||
"@openedx/frontend-build": "14.1.4",
|
||||
"@openedx/paragon": "22.7.0",
|
||||
"@testing-library/dom": "10.4.0",
|
||||
"@testing-library/jest-dom": "5.17.0",
|
||||
"@testing-library/react": "10.4.9",
|
||||
"@wojtekmaj/enzyme-adapter-react-17": "0.8.0",
|
||||
"enzyme": "3.11.0",
|
||||
"husky": "8.0.3",
|
||||
"jest": "29.7.0",
|
||||
"jest-chain": "1.1.6",
|
||||
@@ -50,25 +49,27 @@
|
||||
"react": "17.0.2",
|
||||
"react-dom": "17.0.2",
|
||||
"react-redux": "7.2.9",
|
||||
"react-router-dom": "6.18.0",
|
||||
"react-router-dom": "6.26.2",
|
||||
"react-test-renderer": "17.0.2",
|
||||
"redux": "4.2.1",
|
||||
"redux-saga": "1.2.3"
|
||||
"redux-saga": "1.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@edx/paragon": "21.5.6",
|
||||
"@fortawesome/fontawesome-svg-core": "6.4.2",
|
||||
"@fortawesome/free-brands-svg-icons": "6.4.2",
|
||||
"@fortawesome/free-regular-svg-icons": "6.4.2",
|
||||
"@fortawesome/free-solid-svg-icons": "6.4.2",
|
||||
"@fortawesome/fontawesome-svg-core": "6.6.0",
|
||||
"@fortawesome/free-brands-svg-icons": "6.6.0",
|
||||
"@fortawesome/free-regular-svg-icons": "6.6.0",
|
||||
"@fortawesome/free-solid-svg-icons": "6.6.0",
|
||||
"@fortawesome/react-fontawesome": "^0.2.0",
|
||||
"@openedx/frontend-plugin-framework": "^1.3.0",
|
||||
"axios-mock-adapter": "1.22.0",
|
||||
"babel-polyfill": "6.26.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"react-responsive": "8.2.0",
|
||||
"react-transition-group": "4.4.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@edx/frontend-platform": "^4.0.0 || ^5.0.0 || ^6.0.0",
|
||||
"@edx/frontend-platform": "^7.0.0 || ^8.0.0",
|
||||
"@openedx/paragon": ">= 21.5.7 < 23.0.0",
|
||||
"prop-types": "^15.5.10",
|
||||
"react": "^16.9.0 || ^17.0.0",
|
||||
"react-dom": "^16.9.0 || ^17.0.0"
|
||||
|
||||
@@ -6,7 +6,7 @@ import { getConfig } from '@edx/frontend-platform';
|
||||
// Local Components
|
||||
import { Menu, MenuTrigger, MenuContent } from './Menu';
|
||||
import Avatar from './Avatar';
|
||||
import { LinkedLogo, Logo } from './Logo';
|
||||
import LogoSlot from './plugin-slots/LogoSlot';
|
||||
|
||||
// i18n
|
||||
import messages from './Header.messages';
|
||||
@@ -19,31 +19,39 @@ class DesktopHeader extends React.Component {
|
||||
super(props);
|
||||
}
|
||||
|
||||
renderMainMenu() {
|
||||
const { mainMenu } = this.props;
|
||||
|
||||
renderMenu(menu) {
|
||||
// Nodes are accepted as a prop
|
||||
if (!Array.isArray(mainMenu)) {
|
||||
return mainMenu;
|
||||
if (!Array.isArray(menu)) {
|
||||
return menu;
|
||||
}
|
||||
|
||||
return mainMenu.map((menuItem) => {
|
||||
return menu.map((menuItem) => {
|
||||
const {
|
||||
type,
|
||||
href,
|
||||
content,
|
||||
submenuContent,
|
||||
disabled,
|
||||
isActive,
|
||||
onClick,
|
||||
} = menuItem;
|
||||
|
||||
if (type === 'item') {
|
||||
return (
|
||||
<a key={`${type}-${content}`} className="nav-link" href={href}>{content}</a>
|
||||
<a
|
||||
key={`${type}-${content}`}
|
||||
className={`nav-link${disabled ? ' disabled' : ''}${isActive ? ' active' : ''}`}
|
||||
href={href}
|
||||
onClick={onClick || null}
|
||||
>
|
||||
{content}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Menu key={`${type}-${content}`} tag="div" className="nav-item" respondToPointerEvents>
|
||||
<MenuTrigger tag="a" className="nav-link d-inline-flex align-items-center" href={href}>
|
||||
<MenuTrigger onClick={onClick || null} tag="a" className="nav-link d-inline-flex align-items-center" href={href}>
|
||||
{content} <CaretIcon role="img" aria-hidden focusable="false" />
|
||||
</MenuTrigger>
|
||||
<MenuContent className="pin-left pin-right shadow py-2">
|
||||
@@ -54,22 +62,14 @@ class DesktopHeader extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
// Renders an optional App Menu for
|
||||
renderAppMenu() {
|
||||
const { appMenu } = this.props;
|
||||
const { content: appMenuContent, menuItems } = appMenu;
|
||||
return (
|
||||
<Menu transitionClassName="menu-dropdown" transitionTimeout={250}>
|
||||
<MenuTrigger tag="a" className="nav-link d-inline-flex align-items-center">
|
||||
{appMenuContent} <CaretIcon role="img" aria-hidden focusable="false" />
|
||||
</MenuTrigger>
|
||||
<MenuContent className="mb-0 dropdown-menu show dropdown-menu-right pin-right shadow py-2">
|
||||
{menuItems.map(({ type, href, content }) => (
|
||||
<a className={`dropdown-${type}`} key={`${type}-${content}`} href={href}>{content}</a>
|
||||
))}
|
||||
</MenuContent>
|
||||
</Menu>
|
||||
);
|
||||
renderMainMenu() {
|
||||
const { mainMenu } = this.props;
|
||||
return this.renderMenu(mainMenu);
|
||||
}
|
||||
|
||||
renderSecondaryMenu() {
|
||||
const { secondaryMenu } = this.props;
|
||||
return this.renderMenu(secondaryMenu);
|
||||
}
|
||||
|
||||
renderUserMenu() {
|
||||
@@ -91,8 +91,24 @@ class DesktopHeader extends React.Component {
|
||||
{username} <CaretIcon role="img" aria-hidden focusable="false" />
|
||||
</MenuTrigger>
|
||||
<MenuContent className="mb-0 dropdown-menu show dropdown-menu-right pin-right shadow py-2">
|
||||
{userMenu.map(({ type, href, content }) => (
|
||||
<a className={`dropdown-${type}`} key={`${type}-${content}`} href={href}>{content}</a>
|
||||
{userMenu.map((group, index) => (
|
||||
// eslint-disable-next-line react/jsx-no-comment-textnodes,react/no-array-index-key
|
||||
<React.Fragment key={index}>
|
||||
{group.heading && <div className="dropdown-header" role="heading" aria-level="1">{group.heading}</div>}
|
||||
{group.items.map(({
|
||||
type, content, href, disabled, isActive, onClick,
|
||||
}) => (
|
||||
<a
|
||||
className={`dropdown-${type}${isActive ? ' active' : ''}${disabled ? ' disabled' : ''}`}
|
||||
key={`${type}-${content}`}
|
||||
href={href}
|
||||
onClick={onClick || null}
|
||||
>
|
||||
{content}
|
||||
</a>
|
||||
))}
|
||||
{index < userMenu.length - 1 && <div className="dropdown-divider" role="separator" />}
|
||||
</React.Fragment>
|
||||
))}
|
||||
</MenuContent>
|
||||
</Menu>
|
||||
@@ -120,7 +136,6 @@ class DesktopHeader extends React.Component {
|
||||
logoDestination,
|
||||
loggedIn,
|
||||
intl,
|
||||
appMenu,
|
||||
} = this.props;
|
||||
const logoProps = { src: logo, alt: logoAltText, href: logoDestination };
|
||||
const logoClasses = getConfig().AUTHN_MINIMAL_HEADER ? 'mw-100' : null;
|
||||
@@ -130,26 +145,24 @@ class DesktopHeader extends React.Component {
|
||||
<a className="nav-skip sr-only sr-only-focusable" href="#main">{intl.formatMessage(messages['header.label.skip.nav'])}</a>
|
||||
<div className={`container-fluid ${logoClasses}`}>
|
||||
<div className="nav-container position-relative d-flex align-items-center">
|
||||
{logoDestination === null ? <Logo className="logo" src={logo} alt={logoAltText} /> : <LinkedLogo className="logo" {...logoProps} />}
|
||||
<LogoSlot {...logoProps} />
|
||||
<nav
|
||||
aria-label={intl.formatMessage(messages['header.label.main.nav'])}
|
||||
className="nav main-nav"
|
||||
>
|
||||
{this.renderMainMenu()}
|
||||
</nav>
|
||||
{appMenu ? (
|
||||
<nav
|
||||
aria-label={intl.formatMessage(messages['header.label.app.nav'])}
|
||||
className="nav app-nav"
|
||||
>
|
||||
{this.renderAppMenu()}
|
||||
</nav>
|
||||
) : null}
|
||||
<nav
|
||||
aria-label={intl.formatMessage(messages['header.label.secondary.nav'])}
|
||||
className="nav secondary-menu-container align-items-center ml-auto"
|
||||
>
|
||||
{loggedIn ? this.renderUserMenu() : this.renderLoggedOutItems()}
|
||||
{loggedIn
|
||||
? (
|
||||
<>
|
||||
{this.renderSecondaryMenu()}
|
||||
{this.renderUserMenu()}
|
||||
</>
|
||||
) : this.renderLoggedOutItems()}
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
@@ -163,10 +176,19 @@ DesktopHeader.propTypes = {
|
||||
PropTypes.node,
|
||||
PropTypes.array,
|
||||
]),
|
||||
secondaryMenu: PropTypes.oneOfType([
|
||||
PropTypes.node,
|
||||
PropTypes.array,
|
||||
]),
|
||||
userMenu: PropTypes.arrayOf(PropTypes.shape({
|
||||
type: PropTypes.oneOf(['item', 'menu']),
|
||||
href: PropTypes.string,
|
||||
content: PropTypes.string,
|
||||
heading: PropTypes.string,
|
||||
items: PropTypes.arrayOf(PropTypes.shape({
|
||||
type: PropTypes.oneOf(['item', 'menu']),
|
||||
href: PropTypes.string,
|
||||
content: PropTypes.string,
|
||||
isActive: PropTypes.bool,
|
||||
onClick: PropTypes.func,
|
||||
})),
|
||||
})),
|
||||
loggedOutItems: PropTypes.arrayOf(PropTypes.shape({
|
||||
type: PropTypes.oneOf(['item', 'menu']),
|
||||
@@ -182,24 +204,11 @@ DesktopHeader.propTypes = {
|
||||
|
||||
// i18n
|
||||
intl: intlShape.isRequired,
|
||||
|
||||
// appMenu
|
||||
appMenu: PropTypes.shape(
|
||||
{
|
||||
content: PropTypes.string,
|
||||
menuItems: PropTypes.arrayOf(
|
||||
PropTypes.shape({
|
||||
type: PropTypes.string,
|
||||
href: PropTypes.string,
|
||||
content: PropTypes.string,
|
||||
}),
|
||||
),
|
||||
},
|
||||
),
|
||||
};
|
||||
|
||||
DesktopHeader.defaultProps = {
|
||||
mainMenu: [],
|
||||
secondaryMenu: [],
|
||||
userMenu: [],
|
||||
loggedOutItems: [],
|
||||
logo: null,
|
||||
@@ -208,7 +217,6 @@ DesktopHeader.defaultProps = {
|
||||
avatar: null,
|
||||
username: null,
|
||||
loggedIn: false,
|
||||
appMenu: null,
|
||||
};
|
||||
|
||||
export default injectIntl(DesktopHeader);
|
||||
|
||||
115
src/Header.jsx
115
src/Header.jsx
@@ -10,6 +10,7 @@ import {
|
||||
subscribe,
|
||||
} from '@edx/frontend-platform';
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import DesktopHeader from './DesktopHeader';
|
||||
import MobileHeader from './MobileHeader';
|
||||
|
||||
@@ -30,50 +31,68 @@ subscribe(APP_CONFIG_INITIALIZED, () => {
|
||||
}, 'Header additional config');
|
||||
});
|
||||
|
||||
const Header = ({ intl }) => {
|
||||
/**
|
||||
* Header component for the application.
|
||||
* Displays a header with the provided main menu, secondary menu, and user menu when the user is authenticated.
|
||||
* If any of the props (mainMenuItems, secondaryMenuItems, userMenuItems) are not provided, default
|
||||
* items are displayed.
|
||||
* For more details on how to use this component, please refer to this document:
|
||||
* https://github.com/openedx/frontend-component-header/blob/master/docs/using_custom_header.rst
|
||||
*
|
||||
* @param {list} mainMenuItems - The list of main menu items to display.
|
||||
* See the documentation for the structure of main menu item.
|
||||
* @param {list} secondaryMenuItems - The list of secondary menu items to display.
|
||||
* See the documentation for the structure of secondary menu item.
|
||||
* @param {list} userMenuItems - The list of user menu items to display.
|
||||
* See the documentation for the structure of user menu item.
|
||||
*/
|
||||
const Header = ({
|
||||
intl, mainMenuItems, secondaryMenuItems, userMenuItems,
|
||||
}) => {
|
||||
const { authenticatedUser, config } = useContext(AppContext);
|
||||
|
||||
const mainMenu = [
|
||||
const defaultMainMenu = [
|
||||
{
|
||||
type: 'item',
|
||||
href: `${config.LMS_BASE_URL}/dashboard`,
|
||||
content: intl.formatMessage(messages['header.links.courses']),
|
||||
},
|
||||
];
|
||||
const defaultUserMenu = authenticatedUser === null ? [] : [{
|
||||
heading: '',
|
||||
items: [
|
||||
{
|
||||
type: 'item',
|
||||
href: `${config.LMS_BASE_URL}/dashboard`,
|
||||
content: intl.formatMessage(messages['header.user.menu.dashboard']),
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
href: `${config.ACCOUNT_PROFILE_URL}/u/${authenticatedUser.username}`,
|
||||
content: intl.formatMessage(messages['header.user.menu.profile']),
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
href: config.ACCOUNT_SETTINGS_URL,
|
||||
content: intl.formatMessage(messages['header.user.menu.account.settings']),
|
||||
},
|
||||
// Users should only see Order History if have a ORDER_HISTORY_URL define in the environment.
|
||||
...(config.ORDER_HISTORY_URL ? [{
|
||||
type: 'item',
|
||||
href: config.ORDER_HISTORY_URL,
|
||||
content: intl.formatMessage(messages['header.user.menu.order.history']),
|
||||
}] : []),
|
||||
{
|
||||
type: 'item',
|
||||
href: config.LOGOUT_URL,
|
||||
content: intl.formatMessage(messages['header.user.menu.logout']),
|
||||
},
|
||||
],
|
||||
}];
|
||||
|
||||
const orderHistoryItem = {
|
||||
type: 'item',
|
||||
href: config.ORDER_HISTORY_URL,
|
||||
content: intl.formatMessage(messages['header.user.menu.order.history']),
|
||||
};
|
||||
|
||||
const userMenu = authenticatedUser === null ? [] : [
|
||||
{
|
||||
type: 'item',
|
||||
href: `${config.LMS_BASE_URL}/dashboard`,
|
||||
content: intl.formatMessage(messages['header.user.menu.dashboard']),
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
href: `${config.ACCOUNT_PROFILE_URL}/u/${authenticatedUser.username}`,
|
||||
content: intl.formatMessage(messages['header.user.menu.profile']),
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
href: config.ACCOUNT_SETTINGS_URL,
|
||||
content: intl.formatMessage(messages['header.user.menu.account.settings']),
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
href: config.LOGOUT_URL,
|
||||
content: intl.formatMessage(messages['header.user.menu.logout']),
|
||||
},
|
||||
];
|
||||
|
||||
// Users should only see Order History if have a ORDER_HISTORY_URL define in the environment.
|
||||
if (config.ORDER_HISTORY_URL) {
|
||||
userMenu.splice(-1, 0, orderHistoryItem);
|
||||
}
|
||||
const mainMenu = mainMenuItems || defaultMainMenu;
|
||||
const secondaryMenu = secondaryMenuItems || [];
|
||||
const userMenu = authenticatedUser === null ? [] : userMenuItems || defaultUserMenu;
|
||||
|
||||
const loggedOutItems = [
|
||||
{
|
||||
@@ -96,13 +115,14 @@ const Header = ({ intl }) => {
|
||||
username: authenticatedUser !== null ? authenticatedUser.username : null,
|
||||
avatar: authenticatedUser !== null ? authenticatedUser.avatar : null,
|
||||
mainMenu: getConfig().AUTHN_MINIMAL_HEADER ? [] : mainMenu,
|
||||
secondaryMenu: getConfig().AUTHN_MINIMAL_HEADER ? [] : secondaryMenu,
|
||||
userMenu: getConfig().AUTHN_MINIMAL_HEADER ? [] : userMenu,
|
||||
loggedOutItems: getConfig().AUTHN_MINIMAL_HEADER ? [] : loggedOutItems,
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Responsive maxWidth={768}>
|
||||
<Responsive maxWidth={769}>
|
||||
<MobileHeader {...props} />
|
||||
</Responsive>
|
||||
<Responsive minWidth={769}>
|
||||
@@ -112,8 +132,31 @@ const Header = ({ intl }) => {
|
||||
);
|
||||
};
|
||||
|
||||
Header.defaultProps = {
|
||||
mainMenuItems: null,
|
||||
secondaryMenuItems: null,
|
||||
userMenuItems: null,
|
||||
};
|
||||
|
||||
Header.propTypes = {
|
||||
intl: intlShape.isRequired,
|
||||
mainMenuItems: PropTypes.oneOfType([
|
||||
PropTypes.node,
|
||||
PropTypes.array,
|
||||
]),
|
||||
secondaryMenuItems: PropTypes.oneOfType([
|
||||
PropTypes.node,
|
||||
PropTypes.array,
|
||||
]),
|
||||
userMenuItems: PropTypes.arrayOf(PropTypes.shape({
|
||||
heading: PropTypes.string,
|
||||
items: PropTypes.arrayOf(PropTypes.shape({
|
||||
type: PropTypes.oneOf(['item', 'menu']),
|
||||
href: PropTypes.string,
|
||||
content: PropTypes.string,
|
||||
isActive: PropTypes.bool,
|
||||
})),
|
||||
})),
|
||||
};
|
||||
|
||||
export default injectIntl(Header);
|
||||
|
||||
16
src/Logo.jsx
16
src/Logo.jsx
@@ -1,31 +1,21 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
const Logo = ({ src, alt, ...attributes }) => (
|
||||
<img src={src} alt={alt} {...attributes} />
|
||||
);
|
||||
|
||||
Logo.propTypes = {
|
||||
src: PropTypes.string.isRequired,
|
||||
alt: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
const LinkedLogo = ({
|
||||
const Logo = ({
|
||||
href,
|
||||
src,
|
||||
alt,
|
||||
...attributes
|
||||
}) => (
|
||||
<a href={href} {...attributes}>
|
||||
<a href={href} className="logo" {...attributes}>
|
||||
<img className="d-block" src={src} alt={alt} />
|
||||
</a>
|
||||
);
|
||||
|
||||
LinkedLogo.propTypes = {
|
||||
Logo.propTypes = {
|
||||
href: PropTypes.string.isRequired,
|
||||
src: PropTypes.string.isRequired,
|
||||
alt: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
export { LinkedLogo, Logo };
|
||||
export default Logo;
|
||||
|
||||
@@ -6,7 +6,7 @@ import { getConfig } from '@edx/frontend-platform';
|
||||
// Local Components
|
||||
import { Menu, MenuTrigger, MenuContent } from './Menu';
|
||||
import Avatar from './Avatar';
|
||||
import { LinkedLogo, Logo } from './Logo';
|
||||
import LogoSlot from './plugin-slots/LogoSlot';
|
||||
|
||||
// i18n
|
||||
import messages from './Header.messages';
|
||||
@@ -19,25 +19,31 @@ class MobileHeader extends React.Component {
|
||||
super(props);
|
||||
}
|
||||
|
||||
renderMainMenu() {
|
||||
const { mainMenu } = this.props;
|
||||
|
||||
renderMenu(menu) {
|
||||
// Nodes are accepted as a prop
|
||||
if (!Array.isArray(mainMenu)) {
|
||||
return mainMenu;
|
||||
if (!Array.isArray(menu)) {
|
||||
return menu;
|
||||
}
|
||||
|
||||
return mainMenu.map((menuItem) => {
|
||||
return menu.map((menuItem) => {
|
||||
const {
|
||||
type,
|
||||
href,
|
||||
content,
|
||||
submenuContent,
|
||||
disabled,
|
||||
isActive,
|
||||
onClick,
|
||||
} = menuItem;
|
||||
|
||||
if (type === 'item') {
|
||||
return (
|
||||
<a key={`${type}-${content}`} className="nav-link" href={href}>
|
||||
<a
|
||||
key={`${type}-${content}`}
|
||||
className={`nav-link${disabled ? ' disabled' : ''}${isActive ? ' active' : ''}`}
|
||||
href={href}
|
||||
onClick={onClick || null}
|
||||
>
|
||||
{content}
|
||||
</a>
|
||||
);
|
||||
@@ -45,7 +51,7 @@ class MobileHeader extends React.Component {
|
||||
|
||||
return (
|
||||
<Menu key={`${type}-${content}`} tag="div" className="nav-item">
|
||||
<MenuTrigger tag="a" role="button" tabIndex="0" className="nav-link">
|
||||
<MenuTrigger onClick={onClick || null} tag="a" role="button" tabIndex="0" className="nav-link">
|
||||
{content}
|
||||
</MenuTrigger>
|
||||
<MenuContent className="position-static pin-left pin-right py-2">
|
||||
@@ -56,13 +62,33 @@ class MobileHeader extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
renderMainMenu() {
|
||||
const { mainMenu } = this.props;
|
||||
return this.renderMenu(mainMenu);
|
||||
}
|
||||
|
||||
renderSecondaryMenu() {
|
||||
const { secondaryMenu } = this.props;
|
||||
return this.renderMenu(secondaryMenu);
|
||||
}
|
||||
|
||||
renderUserMenuItems() {
|
||||
const { userMenu } = this.props;
|
||||
|
||||
return userMenu.map(({ type, href, content }) => (
|
||||
<li className="nav-item" key={`${type}-${content}`}>
|
||||
<a className="nav-link" href={href}>{content}</a>
|
||||
</li>
|
||||
return userMenu.map((group) => (
|
||||
group.items.map(({
|
||||
type, content, href, disabled, isActive, onClick,
|
||||
}) => (
|
||||
<li className="nav-item" key={`${type}-${content}`}>
|
||||
<a
|
||||
className={`nav-link${isActive ? ' active' : ''}${disabled ? ' disabled' : ''}`}
|
||||
href={href}
|
||||
onClick={onClick || null}
|
||||
>
|
||||
{content}
|
||||
</a>
|
||||
</li>
|
||||
))
|
||||
));
|
||||
}
|
||||
|
||||
@@ -123,12 +149,13 @@ class MobileHeader extends React.Component {
|
||||
className="nav flex-column pin-left pin-right border-top shadow py-2"
|
||||
>
|
||||
{this.renderMainMenu()}
|
||||
{this.renderSecondaryMenu()}
|
||||
</MenuContent>
|
||||
</Menu>
|
||||
</div>
|
||||
) : null}
|
||||
<div className={`w-100 d-flex ${logoClasses}`}>
|
||||
{ logoDestination === null ? <Logo className="logo" src={logo} alt={logoAltText} /> : <LinkedLogo className="logo" {...logoProps} itemType="http://schema.org/Organization" />}
|
||||
<LogoSlot {...logoProps} itemType="http://schema.org/Organization" />
|
||||
</div>
|
||||
{userMenu.length > 0 || loggedOutItems.length > 0 ? (
|
||||
<div className="w-100 d-flex justify-content-end align-items-center">
|
||||
@@ -157,11 +184,19 @@ MobileHeader.propTypes = {
|
||||
PropTypes.node,
|
||||
PropTypes.array,
|
||||
]),
|
||||
|
||||
secondaryMenu: PropTypes.oneOfType([
|
||||
PropTypes.node,
|
||||
PropTypes.array,
|
||||
]),
|
||||
userMenu: PropTypes.arrayOf(PropTypes.shape({
|
||||
type: PropTypes.oneOf(['item', 'menu']),
|
||||
href: PropTypes.string,
|
||||
content: PropTypes.string,
|
||||
heading: PropTypes.string,
|
||||
items: PropTypes.arrayOf(PropTypes.shape({
|
||||
type: PropTypes.oneOf(['item', 'menu']),
|
||||
href: PropTypes.string,
|
||||
content: PropTypes.string,
|
||||
isActive: PropTypes.bool,
|
||||
onClick: PropTypes.func,
|
||||
})),
|
||||
})),
|
||||
loggedOutItems: PropTypes.arrayOf(PropTypes.shape({
|
||||
type: PropTypes.oneOf(['item', 'menu']),
|
||||
@@ -182,6 +217,7 @@ MobileHeader.propTypes = {
|
||||
|
||||
MobileHeader.defaultProps = {
|
||||
mainMenu: [],
|
||||
secondaryMenu: [],
|
||||
userMenu: [],
|
||||
loggedOutItems: [],
|
||||
logo: null,
|
||||
|
||||
@@ -33,6 +33,7 @@ exports[`<Header /> renders correctly for anonymous desktop 1`] = `
|
||||
<a
|
||||
className="nav-link"
|
||||
href="http://localhost:18000/dashboard"
|
||||
onClick={null}
|
||||
>
|
||||
Courses
|
||||
</a>
|
||||
@@ -93,7 +94,7 @@ exports[`<Header /> renders correctly for anonymous mobile 1`] = `
|
||||
height="24px"
|
||||
role="img"
|
||||
style={
|
||||
Object {
|
||||
{
|
||||
"height": "1.5rem",
|
||||
"width": "1.5rem",
|
||||
}
|
||||
@@ -163,7 +164,7 @@ exports[`<Header /> renders correctly for anonymous mobile 1`] = `
|
||||
<span
|
||||
className="avatar overflow-hidden d-inline-flex rounded-circle null"
|
||||
style={
|
||||
Object {
|
||||
{
|
||||
"height": "1.5rem",
|
||||
"width": "1.5rem",
|
||||
}
|
||||
@@ -175,7 +176,7 @@ exports[`<Header /> renders correctly for anonymous mobile 1`] = `
|
||||
height="24px"
|
||||
role="img"
|
||||
style={
|
||||
Object {
|
||||
{
|
||||
"height": "1.5rem",
|
||||
"width": "1.5rem",
|
||||
}
|
||||
@@ -229,6 +230,7 @@ exports[`<Header /> renders correctly for authenticated desktop 1`] = `
|
||||
<a
|
||||
className="nav-link"
|
||||
href="http://localhost:18000/dashboard"
|
||||
onClick={null}
|
||||
>
|
||||
Courses
|
||||
</a>
|
||||
@@ -253,7 +255,7 @@ exports[`<Header /> renders correctly for authenticated desktop 1`] = `
|
||||
<span
|
||||
className="avatar overflow-hidden d-inline-flex rounded-circle mr-2"
|
||||
style={
|
||||
Object {
|
||||
{
|
||||
"height": "1.5em",
|
||||
"width": "1.5em",
|
||||
}
|
||||
@@ -265,7 +267,7 @@ exports[`<Header /> renders correctly for authenticated desktop 1`] = `
|
||||
height="24px"
|
||||
role="img"
|
||||
style={
|
||||
Object {
|
||||
{
|
||||
"height": "1.5em",
|
||||
"width": "1.5em",
|
||||
}
|
||||
@@ -339,7 +341,7 @@ exports[`<Header /> renders correctly for authenticated mobile 1`] = `
|
||||
height="24px"
|
||||
role="img"
|
||||
style={
|
||||
Object {
|
||||
{
|
||||
"height": "1.5rem",
|
||||
"width": "1.5rem",
|
||||
}
|
||||
@@ -409,7 +411,7 @@ exports[`<Header /> renders correctly for authenticated mobile 1`] = `
|
||||
<span
|
||||
className="avatar overflow-hidden d-inline-flex rounded-circle null"
|
||||
style={
|
||||
Object {
|
||||
{
|
||||
"height": "1.5rem",
|
||||
"width": "1.5rem",
|
||||
}
|
||||
@@ -421,7 +423,7 @@ exports[`<Header /> renders correctly for authenticated mobile 1`] = `
|
||||
height="24px"
|
||||
role="img"
|
||||
style={
|
||||
Object {
|
||||
{
|
||||
"height": "1.5rem",
|
||||
"width": "1.5rem",
|
||||
}
|
||||
|
||||
@@ -1,28 +1 @@
|
||||
import arMessages from './messages/ar.json';
|
||||
import frMessages from './messages/fr.json';
|
||||
import es419Messages from './messages/es_419.json';
|
||||
import zhcnMessages from './messages/zh_CN.json';
|
||||
import ptMessages from './messages/pt.json';
|
||||
import itMessages from './messages/it.json';
|
||||
import ukMessages from './messages/uk.json';
|
||||
import deMessages from './messages/de.json';
|
||||
import ruMessages from './messages/ru.json';
|
||||
import hiMessages from './messages/hi.json';
|
||||
import frCAMessages from './messages/fr_CA.json';
|
||||
// no need to import en messages-- they are in the defaultMessage field
|
||||
|
||||
const messages = {
|
||||
ar: arMessages,
|
||||
'es-419': es419Messages,
|
||||
fr: frMessages,
|
||||
'zh-cn': zhcnMessages,
|
||||
pt: ptMessages,
|
||||
it: itMessages,
|
||||
de: deMessages,
|
||||
hi: hiMessages,
|
||||
'fr-ca': frCAMessages,
|
||||
ru: ruMessages,
|
||||
uk: ukMessages,
|
||||
};
|
||||
|
||||
export default messages;
|
||||
export default {};
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
{
|
||||
"header.links.courses": "المساقات",
|
||||
"header.links.programs": "البرامج",
|
||||
"header.links.content.search": "اكتشف الجديد",
|
||||
"header.links.schools": "المدارس و الشركاء",
|
||||
"header.user.menu.dashboard": "لوحة المعلومات",
|
||||
"header.user.menu.profile": "الملف الشخصي",
|
||||
"header.user.menu.account.settings": "الحساب",
|
||||
"header.user.menu.order.history": "سجل الطلبيات",
|
||||
"header.user.menu.logout": "تسجيل الخروج",
|
||||
"header.user.menu.login": "تسجيل الدخول",
|
||||
"header.user.menu.register": "التسجيل",
|
||||
"header.user.menu.studio.home": "صفحة الاستوديو الرئيسية",
|
||||
"header.user.menu.studio.maintenance": "الصيانة",
|
||||
"header.label.account.nav": "الحساب",
|
||||
"header.label.account.menu": "قائمة الحساب",
|
||||
"header.label.account.menu.for": "قائمة حساب المستخدم {username}",
|
||||
"header.label.main.nav": "القا|مة الرئيسية",
|
||||
"header.label.main.menu": "القائمة الرئيسية",
|
||||
"header.label.main.header": "الرئيسية",
|
||||
"header.label.secondary.nav": "القائمة الثانوية",
|
||||
"header.label.skip.nav": "التخطي إلى المحتوى الرئيسي",
|
||||
"header.label.app.nav": "تطبيق",
|
||||
"general.register.sentenceCase": "التسجيل",
|
||||
"general.signIn.sentenceCase": "تسجيل الدخول",
|
||||
"header.menu.dashboard.label": "لوحة المعلومات",
|
||||
"header.help.label": "المساعدة",
|
||||
"header.menu.profile.label": "الملف الشخصي",
|
||||
"header.menu.account.label": "الحساب",
|
||||
"header.menu.orderHistory.label": "سجل الطلبيات",
|
||||
"header.navigation.skipNavLink": "التخطي إلى المحتوى الرئيسي",
|
||||
"header.menu.signOut.label": "تسجيل الخروج",
|
||||
"header.links.content": "Content",
|
||||
"header.links.settings": "Settings",
|
||||
"header.links.content.tools": "Tools",
|
||||
"header.links.outline": "Outline",
|
||||
"header.links.updates": "Updates",
|
||||
"header.links.pages": "Pages & Resources",
|
||||
"header.links.filesAndUploads": "Files & Uploads",
|
||||
"header.links.textbooks": "Textbooks",
|
||||
"header.links.videoUploads": "Video Uploads",
|
||||
"header.links.scheduleAndDetails": "Schedule & Details",
|
||||
"header.links.grading": "Grading",
|
||||
"header.links.courseTeam": "Course Team",
|
||||
"header.links.groupConfigurations": "Group Configurations",
|
||||
"header.links.proctoredExamSettings": "Proctored Exam Settings",
|
||||
"header.links.advancedSettings": "Advanced Settings",
|
||||
"header.links.certificates": "Certificates",
|
||||
"header.links.publisher": "Publisher",
|
||||
"header.links.import": "Import",
|
||||
"header.links.export": "Export",
|
||||
"header.links.checklists": "Checklists",
|
||||
"header.user.menu.studio": "Studio Home",
|
||||
"header.user.menu.maintenance": "Maintenance",
|
||||
"header.label.courseOutline": "Back to course outline in Studio"
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
{
|
||||
"header.links.courses": "Courses",
|
||||
"header.links.programs": "Programs",
|
||||
"header.links.content.search": "Discover New",
|
||||
"header.links.schools": "Schools & Partners",
|
||||
"header.user.menu.dashboard": "Dashboard",
|
||||
"header.user.menu.profile": "Profile",
|
||||
"header.user.menu.account.settings": "Account",
|
||||
"header.user.menu.order.history": "Order History",
|
||||
"header.user.menu.logout": "Logout",
|
||||
"header.user.menu.login": "Login",
|
||||
"header.user.menu.register": "Sign Up",
|
||||
"header.user.menu.studio.home": "Studio Home",
|
||||
"header.user.menu.studio.maintenance": "Maintenance",
|
||||
"header.label.account.nav": "Account",
|
||||
"header.label.account.menu": "Account Menu",
|
||||
"header.label.account.menu.for": "Account menu for {username}",
|
||||
"header.label.main.nav": "Main",
|
||||
"header.label.main.menu": "Main Menu",
|
||||
"header.label.main.header": "Main",
|
||||
"header.label.secondary.nav": "Secondary",
|
||||
"header.label.skip.nav": "Skip to main content",
|
||||
"header.label.app.nav": "App",
|
||||
"general.register.sentenceCase": "Register",
|
||||
"general.signIn.sentenceCase": "Sign in",
|
||||
"header.menu.dashboard.label": "Dashboard",
|
||||
"header.help.label": "Help",
|
||||
"header.menu.profile.label": "Profile",
|
||||
"header.menu.account.label": "Account",
|
||||
"header.menu.orderHistory.label": "Order History",
|
||||
"header.navigation.skipNavLink": "Skip to main content.",
|
||||
"header.menu.signOut.label": "Sign Out",
|
||||
"header.links.content": "Content",
|
||||
"header.links.settings": "Settings",
|
||||
"header.links.content.tools": "Tools",
|
||||
"header.links.outline": "Outline",
|
||||
"header.links.updates": "Updates",
|
||||
"header.links.pages": "Pages & Resources",
|
||||
"header.links.filesAndUploads": "Files & Uploads",
|
||||
"header.links.textbooks": "Textbooks",
|
||||
"header.links.videoUploads": "Video Uploads",
|
||||
"header.links.scheduleAndDetails": "Schedule & Details",
|
||||
"header.links.grading": "Grading",
|
||||
"header.links.courseTeam": "Course Team",
|
||||
"header.links.groupConfigurations": "Group Configurations",
|
||||
"header.links.proctoredExamSettings": "Proctored Exam Settings",
|
||||
"header.links.advancedSettings": "Advanced Settings",
|
||||
"header.links.certificates": "Certificates",
|
||||
"header.links.publisher": "Publisher",
|
||||
"header.links.import": "Import",
|
||||
"header.links.export": "Export",
|
||||
"header.links.checklists": "Checklists",
|
||||
"header.user.menu.studio": "Studio Home",
|
||||
"header.user.menu.maintenance": "Maintenance",
|
||||
"header.label.courseOutline": "Back to course outline in Studio"
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
{
|
||||
"header.links.courses": "Cursos",
|
||||
"header.links.programs": "Programas",
|
||||
"header.links.content.search": "Encontrar nuevo",
|
||||
"header.links.schools": "Escuelas y Socios",
|
||||
"header.user.menu.dashboard": "Panel de Control",
|
||||
"header.user.menu.profile": "Perfil",
|
||||
"header.user.menu.account.settings": "Cuenta",
|
||||
"header.user.menu.order.history": "Historial de órdenes",
|
||||
"header.user.menu.logout": "Cerrar sesión",
|
||||
"header.user.menu.login": "Login",
|
||||
"header.user.menu.register": "Registrarse",
|
||||
"header.user.menu.studio.home": "Inicio Studio",
|
||||
"header.user.menu.studio.maintenance": "Mantenimiento",
|
||||
"header.label.account.nav": "Cuenta",
|
||||
"header.label.account.menu": "Menú de la cuenta",
|
||||
"header.label.account.menu.for": "Menú de la cuenta para {username}",
|
||||
"header.label.main.nav": "Principal",
|
||||
"header.label.main.menu": "Menú Principal",
|
||||
"header.label.main.header": "Principal",
|
||||
"header.label.secondary.nav": "Secondary",
|
||||
"header.label.skip.nav": "Ir al contenido principal",
|
||||
"header.label.app.nav": "Aplicación",
|
||||
"general.register.sentenceCase": "Registrarse",
|
||||
"general.signIn.sentenceCase": "Iniciar sesión",
|
||||
"header.menu.dashboard.label": "Panel de Control",
|
||||
"header.help.label": "Ayuda",
|
||||
"header.menu.profile.label": "Perfil",
|
||||
"header.menu.account.label": "Cuenta",
|
||||
"header.menu.orderHistory.label": "Historial de órdenes",
|
||||
"header.navigation.skipNavLink": "Dirígete al contenido principal.",
|
||||
"header.menu.signOut.label": "Cerrar sesión",
|
||||
"header.links.content": "Contenido",
|
||||
"header.links.settings": "Configuración",
|
||||
"header.links.content.tools": "Herramientas",
|
||||
"header.links.outline": "Estructura",
|
||||
"header.links.updates": "Actualizaciones",
|
||||
"header.links.pages": "Páginas & Recursos",
|
||||
"header.links.filesAndUploads": "Administración de archivos",
|
||||
"header.links.textbooks": "Libros de texto",
|
||||
"header.links.videoUploads": "Carga de videos",
|
||||
"header.links.scheduleAndDetails": "Calendario y detalles",
|
||||
"header.links.grading": "Calificaciones",
|
||||
"header.links.courseTeam": "Equipo del curso",
|
||||
"header.links.groupConfigurations": "Configuraciones de Grupo",
|
||||
"header.links.proctoredExamSettings": "Configuración de Exámenes Supervisados",
|
||||
"header.links.advancedSettings": "Configuración avanzada",
|
||||
"header.links.certificates": "Certificados",
|
||||
"header.links.publisher": "Publisher",
|
||||
"header.links.import": "Importar",
|
||||
"header.links.export": "Exportar",
|
||||
"header.links.checklists": "Listas de chequeo",
|
||||
"header.user.menu.studio": "Inicio Studio",
|
||||
"header.user.menu.maintenance": "Mantenimiento",
|
||||
"header.label.courseOutline": "Volver al esquema del curso en Studio"
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
{
|
||||
"header.links.courses": "Cours",
|
||||
"header.links.programs": "Programmes",
|
||||
"header.links.content.search": "Explorer les cours",
|
||||
"header.links.schools": "Écoles et partenaires",
|
||||
"header.user.menu.dashboard": "Tableau de bord",
|
||||
"header.user.menu.profile": "Profil",
|
||||
"header.user.menu.account.settings": "Compte",
|
||||
"header.user.menu.order.history": "Historique des commandes",
|
||||
"header.user.menu.logout": "Déconnexion",
|
||||
"header.user.menu.login": "Connexion",
|
||||
"header.user.menu.register": "S'inscrire",
|
||||
"header.user.menu.studio.home": "Accueil Studio",
|
||||
"header.user.menu.studio.maintenance": "Maintenance",
|
||||
"header.label.account.nav": "Compte",
|
||||
"header.label.account.menu": "Menu du compte",
|
||||
"header.label.account.menu.for": "Menu du compte pour {username}",
|
||||
"header.label.main.nav": "Principal",
|
||||
"header.label.main.menu": "Menu Principal",
|
||||
"header.label.main.header": "Principal",
|
||||
"header.label.secondary.nav": "Secondaire",
|
||||
"header.label.skip.nav": "Passer au contenu principal",
|
||||
"header.label.app.nav": "Application",
|
||||
"general.register.sentenceCase": "S'inscrire",
|
||||
"general.signIn.sentenceCase": "Connectez-vous",
|
||||
"header.menu.dashboard.label": "Tableau de bord",
|
||||
"header.help.label": "Aide",
|
||||
"header.menu.profile.label": "Profil",
|
||||
"header.menu.account.label": "Compte",
|
||||
"header.menu.orderHistory.label": "Historique des commandes",
|
||||
"header.navigation.skipNavLink": "Passer au contenu principal",
|
||||
"header.menu.signOut.label": "Se déconnecter",
|
||||
"header.links.content": "Content",
|
||||
"header.links.settings": "Settings",
|
||||
"header.links.content.tools": "Tools",
|
||||
"header.links.outline": "Outline",
|
||||
"header.links.updates": "Updates",
|
||||
"header.links.pages": "Pages & Resources",
|
||||
"header.links.filesAndUploads": "Files & Uploads",
|
||||
"header.links.textbooks": "Textbooks",
|
||||
"header.links.videoUploads": "Video Uploads",
|
||||
"header.links.scheduleAndDetails": "Schedule & Details",
|
||||
"header.links.grading": "Grading",
|
||||
"header.links.courseTeam": "Course Team",
|
||||
"header.links.groupConfigurations": "Group Configurations",
|
||||
"header.links.proctoredExamSettings": "Proctored Exam Settings",
|
||||
"header.links.advancedSettings": "Advanced Settings",
|
||||
"header.links.certificates": "Certificates",
|
||||
"header.links.publisher": "Publisher",
|
||||
"header.links.import": "Import",
|
||||
"header.links.export": "Export",
|
||||
"header.links.checklists": "Checklists",
|
||||
"header.user.menu.studio": "Studio Home",
|
||||
"header.user.menu.maintenance": "Maintenance",
|
||||
"header.label.courseOutline": "Back to course outline in Studio"
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
{
|
||||
"header.links.courses": "Cours",
|
||||
"header.links.programs": "Programmes",
|
||||
"header.links.content.search": "Découvrir les nouveautés",
|
||||
"header.links.schools": "Écoles et Partenaires",
|
||||
"header.user.menu.dashboard": "Tableau de bord",
|
||||
"header.user.menu.profile": "Profil",
|
||||
"header.user.menu.account.settings": "Compte",
|
||||
"header.user.menu.order.history": "Historique des commandes",
|
||||
"header.user.menu.logout": "Déconnexion",
|
||||
"header.user.menu.login": "Connexion",
|
||||
"header.user.menu.register": "S'inscrire",
|
||||
"header.user.menu.studio.home": "Accueil Studio",
|
||||
"header.user.menu.studio.maintenance": "Entretien",
|
||||
"header.label.account.nav": "Compte",
|
||||
"header.label.account.menu": "Menu de compte",
|
||||
"header.label.account.menu.for": "Menu de compte pour {username}",
|
||||
"header.label.main.nav": "Principal",
|
||||
"header.label.main.menu": "Menu principal",
|
||||
"header.label.main.header": "Principal",
|
||||
"header.label.secondary.nav": "Secondaire",
|
||||
"header.label.skip.nav": "Passer au contenu de cette vue",
|
||||
"header.label.app.nav": "Application",
|
||||
"general.register.sentenceCase": "Inscription",
|
||||
"general.signIn.sentenceCase": "Connexion",
|
||||
"header.menu.dashboard.label": "Tableau de bord",
|
||||
"header.help.label": "Aide",
|
||||
"header.menu.profile.label": "Profil",
|
||||
"header.menu.account.label": "Compte",
|
||||
"header.menu.orderHistory.label": "Historique des commandes",
|
||||
"header.navigation.skipNavLink": "Passer au contenu principal.",
|
||||
"header.menu.signOut.label": "Se déconnecter",
|
||||
"header.links.content": "Contenu",
|
||||
"header.links.settings": "Paramètres",
|
||||
"header.links.content.tools": "Outils",
|
||||
"header.links.outline": "Plan de cours",
|
||||
"header.links.updates": "Annonces",
|
||||
"header.links.pages": "Pages et ressources",
|
||||
"header.links.filesAndUploads": "Fichiers et téléversements",
|
||||
"header.links.textbooks": "Manuels",
|
||||
"header.links.videoUploads": "Téléversements des vidéos",
|
||||
"header.links.scheduleAndDetails": "Dates et détails",
|
||||
"header.links.grading": "Évaluation",
|
||||
"header.links.courseTeam": "Équipe de cours",
|
||||
"header.links.groupConfigurations": "Configuration des groupes",
|
||||
"header.links.proctoredExamSettings": "Paramètres d'examen surveillé",
|
||||
"header.links.advancedSettings": "Paramètres avancés",
|
||||
"header.links.certificates": "Attestations",
|
||||
"header.links.publisher": "Éditeur",
|
||||
"header.links.import": "Importer",
|
||||
"header.links.export": "Exporter",
|
||||
"header.links.checklists": "Listes de contrôle",
|
||||
"header.user.menu.studio": "Accueil Studio",
|
||||
"header.user.menu.maintenance": "Entretien",
|
||||
"header.label.courseOutline": "Retour au plan de cours dans Studio"
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
{
|
||||
"header.links.courses": "Courses",
|
||||
"header.links.programs": "Programs",
|
||||
"header.links.content.search": "Discover New",
|
||||
"header.links.schools": "Schools & Partners",
|
||||
"header.user.menu.dashboard": "Dashboard",
|
||||
"header.user.menu.profile": "Profile",
|
||||
"header.user.menu.account.settings": "Account",
|
||||
"header.user.menu.order.history": "Order History",
|
||||
"header.user.menu.logout": "Logout",
|
||||
"header.user.menu.login": "Login",
|
||||
"header.user.menu.register": "Sign Up",
|
||||
"header.user.menu.studio.home": "Studio Home",
|
||||
"header.user.menu.studio.maintenance": "Maintenance",
|
||||
"header.label.account.nav": "Account",
|
||||
"header.label.account.menu": "Account Menu",
|
||||
"header.label.account.menu.for": "Account menu for {username}",
|
||||
"header.label.main.nav": "Main",
|
||||
"header.label.main.menu": "Main Menu",
|
||||
"header.label.main.header": "Main",
|
||||
"header.label.secondary.nav": "Secondary",
|
||||
"header.label.skip.nav": "Skip to main content",
|
||||
"header.label.app.nav": "App",
|
||||
"general.register.sentenceCase": "Register",
|
||||
"general.signIn.sentenceCase": "Sign in",
|
||||
"header.menu.dashboard.label": "Dashboard",
|
||||
"header.help.label": "Help",
|
||||
"header.menu.profile.label": "Profile",
|
||||
"header.menu.account.label": "Account",
|
||||
"header.menu.orderHistory.label": "Order History",
|
||||
"header.navigation.skipNavLink": "Skip to main content.",
|
||||
"header.menu.signOut.label": "Sign Out",
|
||||
"header.links.content": "Content",
|
||||
"header.links.settings": "Settings",
|
||||
"header.links.content.tools": "Tools",
|
||||
"header.links.outline": "Outline",
|
||||
"header.links.updates": "Updates",
|
||||
"header.links.pages": "Pages & Resources",
|
||||
"header.links.filesAndUploads": "Files & Uploads",
|
||||
"header.links.textbooks": "Textbooks",
|
||||
"header.links.videoUploads": "Video Uploads",
|
||||
"header.links.scheduleAndDetails": "Schedule & Details",
|
||||
"header.links.grading": "Grading",
|
||||
"header.links.courseTeam": "Course Team",
|
||||
"header.links.groupConfigurations": "Group Configurations",
|
||||
"header.links.proctoredExamSettings": "Proctored Exam Settings",
|
||||
"header.links.advancedSettings": "Advanced Settings",
|
||||
"header.links.certificates": "Certificates",
|
||||
"header.links.publisher": "Publisher",
|
||||
"header.links.import": "Import",
|
||||
"header.links.export": "Export",
|
||||
"header.links.checklists": "Checklists",
|
||||
"header.user.menu.studio": "Studio Home",
|
||||
"header.user.menu.maintenance": "Maintenance",
|
||||
"header.label.courseOutline": "Back to course outline in Studio"
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
{
|
||||
"header.links.courses": "Courses",
|
||||
"header.links.programs": "Programs",
|
||||
"header.links.content.search": "Discover New",
|
||||
"header.links.schools": "Schools & Partners",
|
||||
"header.user.menu.dashboard": "Dashboard",
|
||||
"header.user.menu.profile": "Profile",
|
||||
"header.user.menu.account.settings": "Account",
|
||||
"header.user.menu.order.history": "Order History",
|
||||
"header.user.menu.logout": "Logout",
|
||||
"header.user.menu.login": "Login",
|
||||
"header.user.menu.register": "Sign Up",
|
||||
"header.user.menu.studio.home": "Studio Home",
|
||||
"header.user.menu.studio.maintenance": "Maintenance",
|
||||
"header.label.account.nav": "Account",
|
||||
"header.label.account.menu": "Account Menu",
|
||||
"header.label.account.menu.for": "Account menu for {username}",
|
||||
"header.label.main.nav": "Main",
|
||||
"header.label.main.menu": "Main Menu",
|
||||
"header.label.main.header": "Main",
|
||||
"header.label.secondary.nav": "Secondary",
|
||||
"header.label.skip.nav": "Skip to main content",
|
||||
"header.label.app.nav": "App",
|
||||
"general.register.sentenceCase": "Register",
|
||||
"general.signIn.sentenceCase": "Sign in",
|
||||
"header.menu.dashboard.label": "Dashboard",
|
||||
"header.help.label": "Help",
|
||||
"header.menu.profile.label": "Profile",
|
||||
"header.menu.account.label": "Account",
|
||||
"header.menu.orderHistory.label": "Order History",
|
||||
"header.navigation.skipNavLink": "Skip to main content.",
|
||||
"header.menu.signOut.label": "Sign Out",
|
||||
"header.links.content": "Content",
|
||||
"header.links.settings": "Settings",
|
||||
"header.links.content.tools": "Tools",
|
||||
"header.links.outline": "Outline",
|
||||
"header.links.updates": "Updates",
|
||||
"header.links.pages": "Pages & Resources",
|
||||
"header.links.filesAndUploads": "Files & Uploads",
|
||||
"header.links.textbooks": "Textbooks",
|
||||
"header.links.videoUploads": "Video Uploads",
|
||||
"header.links.scheduleAndDetails": "Schedule & Details",
|
||||
"header.links.grading": "Grading",
|
||||
"header.links.courseTeam": "Course Team",
|
||||
"header.links.groupConfigurations": "Group Configurations",
|
||||
"header.links.proctoredExamSettings": "Proctored Exam Settings",
|
||||
"header.links.advancedSettings": "Advanced Settings",
|
||||
"header.links.certificates": "Certificates",
|
||||
"header.links.publisher": "Publisher",
|
||||
"header.links.import": "Import",
|
||||
"header.links.export": "Export",
|
||||
"header.links.checklists": "Checklists",
|
||||
"header.user.menu.studio": "Studio Home",
|
||||
"header.user.menu.maintenance": "Maintenance",
|
||||
"header.label.courseOutline": "Back to course outline in Studio"
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
{
|
||||
"header.links.courses": "Courses",
|
||||
"header.links.programs": "Programs",
|
||||
"header.links.content.search": "Discover New",
|
||||
"header.links.schools": "Schools & Partners",
|
||||
"header.user.menu.dashboard": "Dashboard",
|
||||
"header.user.menu.profile": "Profile",
|
||||
"header.user.menu.account.settings": "Account",
|
||||
"header.user.menu.order.history": "Order History",
|
||||
"header.user.menu.logout": "Logout",
|
||||
"header.user.menu.login": "Login",
|
||||
"header.user.menu.register": "Sign Up",
|
||||
"header.user.menu.studio.home": "Studio Home",
|
||||
"header.user.menu.studio.maintenance": "Maintenance",
|
||||
"header.label.account.nav": "Account",
|
||||
"header.label.account.menu": "Account Menu",
|
||||
"header.label.account.menu.for": "Account menu for {username}",
|
||||
"header.label.main.nav": "Main",
|
||||
"header.label.main.menu": "Main Menu",
|
||||
"header.label.main.header": "Main",
|
||||
"header.label.secondary.nav": "Secondary",
|
||||
"header.label.skip.nav": "Skip to main content",
|
||||
"header.label.app.nav": "App",
|
||||
"general.register.sentenceCase": "Register",
|
||||
"general.signIn.sentenceCase": "Sign in",
|
||||
"header.menu.dashboard.label": "Dashboard",
|
||||
"header.help.label": "Help",
|
||||
"header.menu.profile.label": "Profile",
|
||||
"header.menu.account.label": "Account",
|
||||
"header.menu.orderHistory.label": "Order History",
|
||||
"header.navigation.skipNavLink": "Skip to main content.",
|
||||
"header.menu.signOut.label": "Sign Out",
|
||||
"header.links.content": "Content",
|
||||
"header.links.settings": "Settings",
|
||||
"header.links.content.tools": "Tools",
|
||||
"header.links.outline": "Outline",
|
||||
"header.links.updates": "Updates",
|
||||
"header.links.pages": "Pages & Resources",
|
||||
"header.links.filesAndUploads": "Files & Uploads",
|
||||
"header.links.textbooks": "Textbooks",
|
||||
"header.links.videoUploads": "Video Uploads",
|
||||
"header.links.scheduleAndDetails": "Schedule & Details",
|
||||
"header.links.grading": "Grading",
|
||||
"header.links.courseTeam": "Course Team",
|
||||
"header.links.groupConfigurations": "Group Configurations",
|
||||
"header.links.proctoredExamSettings": "Proctored Exam Settings",
|
||||
"header.links.advancedSettings": "Advanced Settings",
|
||||
"header.links.certificates": "Certificates",
|
||||
"header.links.publisher": "Publisher",
|
||||
"header.links.import": "Import",
|
||||
"header.links.export": "Export",
|
||||
"header.links.checklists": "Checklists",
|
||||
"header.user.menu.studio": "Studio Home",
|
||||
"header.user.menu.maintenance": "Maintenance",
|
||||
"header.label.courseOutline": "Back to course outline in Studio"
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
{
|
||||
"header.links.courses": "Courses",
|
||||
"header.links.programs": "Programs",
|
||||
"header.links.content.search": "Discover New",
|
||||
"header.links.schools": "Schools & Partners",
|
||||
"header.user.menu.dashboard": "Dashboard",
|
||||
"header.user.menu.profile": "Profile",
|
||||
"header.user.menu.account.settings": "Account",
|
||||
"header.user.menu.order.history": "Order History",
|
||||
"header.user.menu.logout": "Logout",
|
||||
"header.user.menu.login": "Login",
|
||||
"header.user.menu.register": "Sign Up",
|
||||
"header.user.menu.studio.home": "Studio Home",
|
||||
"header.user.menu.studio.maintenance": "Maintenance",
|
||||
"header.label.account.nav": "Account",
|
||||
"header.label.account.menu": "Account Menu",
|
||||
"header.label.account.menu.for": "Account menu for {username}",
|
||||
"header.label.main.nav": "Main",
|
||||
"header.label.main.menu": "Main Menu",
|
||||
"header.label.main.header": "Main",
|
||||
"header.label.secondary.nav": "Secondary",
|
||||
"header.label.skip.nav": "Skip to main content",
|
||||
"header.label.app.nav": "App",
|
||||
"general.register.sentenceCase": "Register",
|
||||
"general.signIn.sentenceCase": "Sign in",
|
||||
"header.menu.dashboard.label": "Dashboard",
|
||||
"header.help.label": "Help",
|
||||
"header.menu.profile.label": "Profile",
|
||||
"header.menu.account.label": "Account",
|
||||
"header.menu.orderHistory.label": "Order History",
|
||||
"header.navigation.skipNavLink": "Skip to main content.",
|
||||
"header.menu.signOut.label": "Sign Out",
|
||||
"header.links.content": "Content",
|
||||
"header.links.settings": "Settings",
|
||||
"header.links.content.tools": "Tools",
|
||||
"header.links.outline": "Outline",
|
||||
"header.links.updates": "Updates",
|
||||
"header.links.pages": "Pages & Resources",
|
||||
"header.links.filesAndUploads": "Files & Uploads",
|
||||
"header.links.textbooks": "Textbooks",
|
||||
"header.links.videoUploads": "Video Uploads",
|
||||
"header.links.scheduleAndDetails": "Schedule & Details",
|
||||
"header.links.grading": "Grading",
|
||||
"header.links.courseTeam": "Course Team",
|
||||
"header.links.groupConfigurations": "Group Configurations",
|
||||
"header.links.proctoredExamSettings": "Proctored Exam Settings",
|
||||
"header.links.advancedSettings": "Advanced Settings",
|
||||
"header.links.certificates": "Certificates",
|
||||
"header.links.publisher": "Publisher",
|
||||
"header.links.import": "Import",
|
||||
"header.links.export": "Export",
|
||||
"header.links.checklists": "Checklists",
|
||||
"header.user.menu.studio": "Studio Home",
|
||||
"header.user.menu.maintenance": "Maintenance",
|
||||
"header.label.courseOutline": "Back to course outline in Studio"
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
{
|
||||
"header.links.courses": "Курси",
|
||||
"header.links.programs": "Програми",
|
||||
"header.links.content.search": "Discover New",
|
||||
"header.links.schools": "Schools & Partners",
|
||||
"header.user.menu.dashboard": "Dashboard",
|
||||
"header.user.menu.profile": "Profile",
|
||||
"header.user.menu.account.settings": "Account",
|
||||
"header.user.menu.order.history": "Order History",
|
||||
"header.user.menu.logout": "Logout",
|
||||
"header.user.menu.login": "Login",
|
||||
"header.user.menu.register": "Sign Up",
|
||||
"header.user.menu.studio.home": "Studio Home",
|
||||
"header.user.menu.studio.maintenance": "Maintenance",
|
||||
"header.label.account.nav": "Account",
|
||||
"header.label.account.menu": "Меню облікового запису",
|
||||
"header.label.account.menu.for": "Меню облікового запису для {username}",
|
||||
"header.label.main.nav": "Main",
|
||||
"header.label.main.menu": "Main Menu",
|
||||
"header.label.main.header": "Main",
|
||||
"header.label.secondary.nav": "Secondary",
|
||||
"header.label.skip.nav": "Перейти до головного змісту",
|
||||
"header.label.app.nav": "App",
|
||||
"general.register.sentenceCase": "Register",
|
||||
"general.signIn.sentenceCase": "Увійти",
|
||||
"header.menu.dashboard.label": "Dashboard",
|
||||
"header.help.label": "Help",
|
||||
"header.menu.profile.label": "Profile",
|
||||
"header.menu.account.label": "Account",
|
||||
"header.menu.orderHistory.label": "Order History",
|
||||
"header.navigation.skipNavLink": "Перейти до головного змісту.",
|
||||
"header.menu.signOut.label": "Sign Out",
|
||||
"header.links.content": "Content",
|
||||
"header.links.settings": "Settings",
|
||||
"header.links.content.tools": "Tools",
|
||||
"header.links.outline": "Outline",
|
||||
"header.links.updates": "Updates",
|
||||
"header.links.pages": "Pages & Resources",
|
||||
"header.links.filesAndUploads": "Files & Uploads",
|
||||
"header.links.textbooks": "Textbooks",
|
||||
"header.links.videoUploads": "Video Uploads",
|
||||
"header.links.scheduleAndDetails": "Schedule & Details",
|
||||
"header.links.grading": "Grading",
|
||||
"header.links.courseTeam": "Course Team",
|
||||
"header.links.groupConfigurations": "Group Configurations",
|
||||
"header.links.proctoredExamSettings": "Proctored Exam Settings",
|
||||
"header.links.advancedSettings": "Advanced Settings",
|
||||
"header.links.certificates": "Certificates",
|
||||
"header.links.publisher": "Publisher",
|
||||
"header.links.import": "Import",
|
||||
"header.links.export": "Export",
|
||||
"header.links.checklists": "Checklists",
|
||||
"header.user.menu.studio": "Studio Home",
|
||||
"header.user.menu.maintenance": "Maintenance",
|
||||
"header.label.courseOutline": "Back to course outline in Studio"
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
{
|
||||
"header.links.courses": "Courses",
|
||||
"header.links.programs": "Programs",
|
||||
"header.links.content.search": "Discover New",
|
||||
"header.links.schools": "Schools & Partners",
|
||||
"header.user.menu.dashboard": "Dashboard",
|
||||
"header.user.menu.profile": "Profile",
|
||||
"header.user.menu.account.settings": "Account",
|
||||
"header.user.menu.order.history": "Order History",
|
||||
"header.user.menu.logout": "Logout",
|
||||
"header.user.menu.login": "Login",
|
||||
"header.user.menu.register": "Sign Up",
|
||||
"header.user.menu.studio.home": "Studio Home",
|
||||
"header.user.menu.studio.maintenance": "Maintenance",
|
||||
"header.label.account.nav": "Account",
|
||||
"header.label.account.menu": "Account Menu",
|
||||
"header.label.account.menu.for": "Account menu for {username}",
|
||||
"header.label.main.nav": "Main",
|
||||
"header.label.main.menu": "Main Menu",
|
||||
"header.label.main.header": "Main",
|
||||
"header.label.secondary.nav": "Secondary",
|
||||
"header.label.skip.nav": "Skip to main content",
|
||||
"header.label.app.nav": "App",
|
||||
"general.register.sentenceCase": "Register",
|
||||
"general.signIn.sentenceCase": "Sign in",
|
||||
"header.menu.dashboard.label": "Dashboard",
|
||||
"header.help.label": "Help",
|
||||
"header.menu.profile.label": "Profile",
|
||||
"header.menu.account.label": "Account",
|
||||
"header.menu.orderHistory.label": "Order History",
|
||||
"header.navigation.skipNavLink": "Skip to main content.",
|
||||
"header.menu.signOut.label": "Sign Out",
|
||||
"header.links.content": "Content",
|
||||
"header.links.settings": "Settings",
|
||||
"header.links.content.tools": "Tools",
|
||||
"header.links.outline": "Outline",
|
||||
"header.links.updates": "Updates",
|
||||
"header.links.pages": "Pages & Resources",
|
||||
"header.links.filesAndUploads": "Files & Uploads",
|
||||
"header.links.textbooks": "Textbooks",
|
||||
"header.links.videoUploads": "Video Uploads",
|
||||
"header.links.scheduleAndDetails": "Schedule & Details",
|
||||
"header.links.grading": "Grading",
|
||||
"header.links.courseTeam": "Course Team",
|
||||
"header.links.groupConfigurations": "Group Configurations",
|
||||
"header.links.proctoredExamSettings": "Proctored Exam Settings",
|
||||
"header.links.advancedSettings": "Advanced Settings",
|
||||
"header.links.certificates": "Certificates",
|
||||
"header.links.publisher": "Publisher",
|
||||
"header.links.import": "Import",
|
||||
"header.links.export": "Export",
|
||||
"header.links.checklists": "Checklists",
|
||||
"header.user.menu.studio": "Studio Home",
|
||||
"header.user.menu.maintenance": "Maintenance",
|
||||
"header.label.courseOutline": "Back to course outline in Studio"
|
||||
}
|
||||
@@ -3,7 +3,7 @@ $blue: #007db8;
|
||||
$white: #fff;
|
||||
|
||||
@import './Menu/menu.scss';
|
||||
@import './studio-header/header.scss';
|
||||
@import './studio-header/StudioHeader.scss';
|
||||
|
||||
.dropdown-item a {
|
||||
text-decoration: none;
|
||||
@@ -43,9 +43,9 @@ $white: #fff;
|
||||
.user-dropdown {
|
||||
.btn {
|
||||
height: 3rem;
|
||||
@media (max-width: -1 + map-get($grid-breakpoints, "sm")) {
|
||||
padding: 0 0.5rem;
|
||||
}
|
||||
// @media (max-width: -1 + map-get($grid-breakpoints, "sm")) {
|
||||
// padding: 0 0.5rem;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,6 +88,15 @@ $white: #fff;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.secondary-menu-container {
|
||||
.nav-link:hover,
|
||||
.nav-link:focus,
|
||||
.nav-link.active,
|
||||
.expanded .nav-link {
|
||||
background: $component-active-bg;
|
||||
color: $component-active-color;
|
||||
}
|
||||
}
|
||||
.main-nav {
|
||||
.nav-link {
|
||||
padding: 1.125rem 1rem;
|
||||
|
||||
@@ -3,7 +3,7 @@ import React from 'react';
|
||||
import { getConfig } from '@edx/frontend-platform';
|
||||
import { getLoginRedirectUrl } from '@edx/frontend-platform/auth';
|
||||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||
import { Button } from '@edx/paragon';
|
||||
import { Button } from '@openedx/paragon';
|
||||
|
||||
import genericMessages from '../generic/messages';
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faUserCircle } from '@fortawesome/free-solid-svg-icons';
|
||||
import { getConfig } from '@edx/frontend-platform';
|
||||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||
import { Dropdown } from '@edx/paragon';
|
||||
import { Dropdown } from '@openedx/paragon';
|
||||
|
||||
import messages from './messages';
|
||||
|
||||
|
||||
@@ -6,33 +6,16 @@ import { AppContext } from '@edx/frontend-platform/react';
|
||||
|
||||
import AnonymousUserMenu from './AnonymousUserMenu';
|
||||
import AuthenticatedUserDropdown from './AuthenticatedUserDropdown';
|
||||
import LogoSlot from '../plugin-slots/LogoSlot';
|
||||
import messages from './messages';
|
||||
|
||||
const LinkedLogo = ({
|
||||
href,
|
||||
src,
|
||||
alt,
|
||||
...attributes
|
||||
}) => (
|
||||
<a href={href} {...attributes}>
|
||||
<img className="d-block" src={src} alt={alt} />
|
||||
</a>
|
||||
);
|
||||
|
||||
LinkedLogo.propTypes = {
|
||||
href: PropTypes.string.isRequired,
|
||||
src: PropTypes.string.isRequired,
|
||||
alt: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
const LearningHeader = ({
|
||||
courseOrg, courseNumber, courseTitle, intl, showUserDropdown,
|
||||
}) => {
|
||||
const { authenticatedUser } = useContext(AppContext);
|
||||
|
||||
const headerLogo = (
|
||||
<LinkedLogo
|
||||
className="logo"
|
||||
<LogoSlot
|
||||
href={`${getConfig().LMS_BASE_URL}/dashboard`}
|
||||
src={getConfig().LOGO_URL}
|
||||
alt={getConfig().SITE_NAME}
|
||||
|
||||
69
src/plugin-slots/LogoSlot/README.md
Normal file
69
src/plugin-slots/LogoSlot/README.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# Logo Slot
|
||||
|
||||
### Slot ID: `logo_slot`
|
||||
|
||||
## Description
|
||||
|
||||
This slot is used to replace/modify/hide the logo.
|
||||
|
||||
## Examples
|
||||
|
||||
### Modify URL
|
||||
|
||||
The following `env.config.jsx` will modify the link href for the logo.
|
||||
|
||||
```jsx
|
||||
import { PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
||||
|
||||
const modifyLogoHref = ( widget ) => {
|
||||
widget.content.href = "https://openedx.org/";
|
||||
return widget;
|
||||
};
|
||||
|
||||
const config = {
|
||||
pluginSlots: {
|
||||
logo_slot: {
|
||||
keepDefault: true,
|
||||
plugins: [
|
||||
{
|
||||
op: PLUGIN_OPERATIONS.Modify,
|
||||
widgetId: 'default_contents',
|
||||
fn: modifyLogoHref,
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export default config;
|
||||
```
|
||||
|
||||
### Custom Component
|
||||
|
||||
The following `env.config.jsx` will replace the logo entirely (in this case with a centered 🗺️ `h1`)
|
||||
|
||||
```jsx
|
||||
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
||||
|
||||
const config = {
|
||||
pluginSlots: {
|
||||
logo_slot: {
|
||||
keepDefault: false,
|
||||
plugins: [
|
||||
{
|
||||
op: PLUGIN_OPERATIONS.Insert,
|
||||
widget: {
|
||||
id: 'custom_logo_component',
|
||||
type: DIRECT_PLUGIN,
|
||||
RenderWidget: () => (
|
||||
<h1 style={{textAlign: 'center'}}>🗺️</h1>
|
||||
),
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
export default config;
|
||||
```
|
||||
25
src/plugin-slots/LogoSlot/index.jsx
Normal file
25
src/plugin-slots/LogoSlot/index.jsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { PluginSlot } from '@openedx/frontend-plugin-framework';
|
||||
import Logo from '../../Logo';
|
||||
|
||||
const LogoSlot = ({
|
||||
href, src, alt, ...attributes
|
||||
}) => (
|
||||
<PluginSlot
|
||||
id="logo_slot"
|
||||
slotOptions={{
|
||||
mergeProps: true,
|
||||
}}
|
||||
>
|
||||
<Logo href={href} src={src} alt={alt} {...attributes} />
|
||||
</PluginSlot>
|
||||
);
|
||||
|
||||
LogoSlot.propTypes = {
|
||||
href: PropTypes.string.isRequired,
|
||||
src: PropTypes.string.isRequired,
|
||||
alt: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
export default LogoSlot;
|
||||
3
src/plugin-slots/README.md
Normal file
3
src/plugin-slots/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# `frontend-component-header` Plugin Slots
|
||||
|
||||
* [`logo_slot`](./LogoSlot/)
|
||||
@@ -1,9 +1,7 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
|
||||
import Enzyme from 'enzyme';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
|
||||
import '@testing-library/jest-dom';
|
||||
import '@testing-library/jest-dom/extend-expect';
|
||||
import 'babel-polyfill';
|
||||
@@ -17,8 +15,6 @@ import { IntlProvider } from 'react-intl';
|
||||
import AppProvider from '@edx/frontend-platform/react/AppProvider';
|
||||
import appMessages from './i18n';
|
||||
|
||||
Enzyme.configure({ adapter: new Adapter() });
|
||||
|
||||
// These configuration values are usually set in webpack's EnvironmentPlugin however
|
||||
// Jest does not use webpack so we need to set these so for testing
|
||||
process.env.ACCESS_TOKEN_COOKIE_NAME = 'edx-jwt-cookie-header-payload';
|
||||
|
||||
@@ -4,7 +4,7 @@ import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||
import {
|
||||
OverlayTrigger,
|
||||
Tooltip,
|
||||
} from '@edx/paragon';
|
||||
} from '@openedx/paragon';
|
||||
import messages from './messages';
|
||||
|
||||
const CourseLockUp = ({
|
||||
@@ -24,7 +24,7 @@ const CourseLockUp = ({
|
||||
)}
|
||||
>
|
||||
<a
|
||||
className="course-title-lockup w-25 mr-2"
|
||||
className="course-title-lockup mr-2"
|
||||
href={outlineLink}
|
||||
aria-label={intl.formatMessage(messages['header.label.courseOutline'])}
|
||||
data-testid="course-lock-up-block"
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useIntl } from '@edx/frontend-platform/i18n';
|
||||
import {
|
||||
ActionRow,
|
||||
Button,
|
||||
Container,
|
||||
Icon,
|
||||
IconButton,
|
||||
Nav,
|
||||
Row,
|
||||
} from '@edx/paragon';
|
||||
import { Close, MenuIcon } from '@edx/paragon/icons';
|
||||
} from '@openedx/paragon';
|
||||
import { Close, MenuIcon, Search } from '@openedx/paragon/icons';
|
||||
|
||||
import CourseLockUp from './CourseLockUp';
|
||||
import UserMenu from './UserMenu';
|
||||
import BrandNav from './BrandNav';
|
||||
import NavDropdownMenu from './NavDropdownMenu';
|
||||
import messages from './messages';
|
||||
|
||||
const HeaderBody = ({
|
||||
logo,
|
||||
@@ -32,7 +36,10 @@ const HeaderBody = ({
|
||||
isHiddenMainMenu,
|
||||
mainMenuDropdowns,
|
||||
outlineLink,
|
||||
searchButtonAction,
|
||||
}) => {
|
||||
const intl = useIntl();
|
||||
|
||||
const renderBrandNav = (
|
||||
<BrandNav
|
||||
{...{
|
||||
@@ -44,7 +51,7 @@ const HeaderBody = ({
|
||||
);
|
||||
|
||||
return (
|
||||
<Container size="xl" className="px-4">
|
||||
<Container size="xl" className="px-2.5">
|
||||
<ActionRow as="header">
|
||||
{isHiddenMainMenu ? (
|
||||
<Row className="flex-nowrap ml-4">
|
||||
@@ -64,17 +71,19 @@ const HeaderBody = ({
|
||||
Menu
|
||||
</Button>
|
||||
) : (
|
||||
<Row className="flex-nowrap m-0">
|
||||
{renderBrandNav}
|
||||
<CourseLockUp
|
||||
{...{
|
||||
outlineLink,
|
||||
number,
|
||||
org,
|
||||
title,
|
||||
}}
|
||||
/>
|
||||
</Row>
|
||||
<div className="w-25">
|
||||
<Row className="m-0 flex-nowrap">
|
||||
{renderBrandNav}
|
||||
<CourseLockUp
|
||||
{...{
|
||||
outlineLink,
|
||||
number,
|
||||
org,
|
||||
title,
|
||||
}}
|
||||
/>
|
||||
</Row>
|
||||
</div>
|
||||
)}
|
||||
{isMobile ? (
|
||||
<>
|
||||
@@ -82,11 +91,11 @@ const HeaderBody = ({
|
||||
{renderBrandNav}
|
||||
</>
|
||||
) : (
|
||||
<Nav data-testid="desktop-menu" className="ml-4">
|
||||
<Nav data-testid="desktop-menu" className="ml-2">
|
||||
{mainMenuDropdowns.map(dropdown => {
|
||||
const { id, buttonTitle, items } = dropdown;
|
||||
return (
|
||||
<NavDropdownMenu {...{ id, buttonTitle, items }} />
|
||||
<NavDropdownMenu key={id} {...{ id, buttonTitle, items }} />
|
||||
);
|
||||
})}
|
||||
</Nav>
|
||||
@@ -94,6 +103,16 @@ const HeaderBody = ({
|
||||
</>
|
||||
)}
|
||||
<ActionRow.Spacer />
|
||||
{searchButtonAction && (
|
||||
<Nav>
|
||||
<IconButton
|
||||
src={Search}
|
||||
iconAs={Icon}
|
||||
onClick={searchButtonAction}
|
||||
aria-label={intl.formatMessage(messages['header.label.search.nav'])}
|
||||
/>
|
||||
</Nav>
|
||||
)}
|
||||
<Nav>
|
||||
<UserMenu
|
||||
{...{
|
||||
@@ -113,9 +132,9 @@ const HeaderBody = ({
|
||||
HeaderBody.propTypes = {
|
||||
studioBaseUrl: PropTypes.string.isRequired,
|
||||
logoutUrl: PropTypes.string.isRequired,
|
||||
setModalPopupTarget: PropTypes.func.isRequired,
|
||||
toggleModalPopup: PropTypes.func.isRequired,
|
||||
isModalPopupOpen: PropTypes.bool.isRequired,
|
||||
setModalPopupTarget: PropTypes.func,
|
||||
toggleModalPopup: PropTypes.func,
|
||||
isModalPopupOpen: PropTypes.bool,
|
||||
number: PropTypes.string,
|
||||
org: PropTypes.string,
|
||||
title: PropTypes.string,
|
||||
@@ -135,9 +154,13 @@ HeaderBody.propTypes = {
|
||||
})),
|
||||
})),
|
||||
outlineLink: PropTypes.string,
|
||||
searchButtonAction: PropTypes.func,
|
||||
};
|
||||
|
||||
HeaderBody.defaultProps = {
|
||||
setModalPopupTarget: null,
|
||||
toggleModalPopup: null,
|
||||
isModalPopupOpen: false,
|
||||
logo: null,
|
||||
logoAltText: null,
|
||||
number: '',
|
||||
@@ -150,6 +173,7 @@ HeaderBody.defaultProps = {
|
||||
isHiddenMainMenu: false,
|
||||
mainMenuDropdowns: [],
|
||||
outlineLink: null,
|
||||
searchButtonAction: null,
|
||||
};
|
||||
|
||||
export default HeaderBody;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useToggle, ModalPopup } from '@edx/paragon';
|
||||
import { useToggle, ModalPopup } from '@openedx/paragon';
|
||||
import HeaderBody from './HeaderBody';
|
||||
import MobileMenu from './MobileMenu';
|
||||
|
||||
@@ -38,9 +38,6 @@ const MobileHeader = ({
|
||||
MobileHeader.propTypes = {
|
||||
studioBaseUrl: PropTypes.string.isRequired,
|
||||
logoutUrl: PropTypes.string.isRequired,
|
||||
setModalPopupTarget: PropTypes.func.isRequired,
|
||||
toggleModalPopup: PropTypes.func.isRequired,
|
||||
isModalPopupOpen: PropTypes.bool.isRequired,
|
||||
number: PropTypes.string,
|
||||
org: PropTypes.string,
|
||||
title: PropTypes.string,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Collapsible } from '@edx/paragon';
|
||||
import { Collapsible } from '@openedx/paragon';
|
||||
|
||||
const MobileMenu = ({
|
||||
mainMenuDropdowns,
|
||||
|
||||
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
||||
import {
|
||||
Dropdown,
|
||||
DropdownButton,
|
||||
} from '@edx/paragon';
|
||||
} from '@openedx/paragon';
|
||||
|
||||
const NavDropdownMenu = ({
|
||||
id,
|
||||
@@ -13,10 +13,12 @@ const NavDropdownMenu = ({
|
||||
<DropdownButton
|
||||
id={id}
|
||||
title={buttonTitle}
|
||||
variant="tertiary"
|
||||
variant="outline-primary"
|
||||
className="mr-2"
|
||||
>
|
||||
{items.map(item => (
|
||||
<Dropdown.Item
|
||||
key={`${item.title}-dropdown-item`}
|
||||
href={item.href}
|
||||
className="small"
|
||||
>
|
||||
|
||||
@@ -16,7 +16,7 @@ ensureConfig([
|
||||
], 'Studio Header component');
|
||||
|
||||
const StudioHeader = ({
|
||||
number, org, title, isHiddenMainMenu, mainMenuDropdowns, outlineLink,
|
||||
number, org, title, isHiddenMainMenu, mainMenuDropdowns, outlineLink, searchButtonAction,
|
||||
}) => {
|
||||
const { authenticatedUser, config } = useContext(AppContext);
|
||||
const props = {
|
||||
@@ -33,17 +33,19 @@ const StudioHeader = ({
|
||||
isHiddenMainMenu,
|
||||
mainMenuDropdowns,
|
||||
outlineLink,
|
||||
searchButtonAction,
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Responsive maxWidth={768}>
|
||||
<div className="studio-header">
|
||||
<a className="nav-skip sr-only sr-only-focusable" href="#main">Skip to content</a>
|
||||
<Responsive maxWidth={841}>
|
||||
<MobileHeader {...props} />
|
||||
</Responsive>
|
||||
<Responsive minWidth={769}>
|
||||
<Responsive minWidth={842}>
|
||||
<HeaderBody {...props} />
|
||||
</Responsive>
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -61,6 +63,7 @@ StudioHeader.propTypes = {
|
||||
})),
|
||||
})),
|
||||
outlineLink: PropTypes.string,
|
||||
searchButtonAction: PropTypes.func,
|
||||
};
|
||||
|
||||
StudioHeader.defaultProps = {
|
||||
@@ -69,6 +72,7 @@ StudioHeader.defaultProps = {
|
||||
isHiddenMainMenu: false,
|
||||
mainMenuDropdowns: [],
|
||||
outlineLink: null,
|
||||
searchButtonAction: null,
|
||||
};
|
||||
|
||||
export default StudioHeader;
|
||||
|
||||
49
src/studio-header/StudioHeader.scss
Normal file
49
src/studio-header/StudioHeader.scss
Normal file
@@ -0,0 +1,49 @@
|
||||
$spacer: 1rem;
|
||||
$white: #FFFFFF;
|
||||
|
||||
.studio-header {
|
||||
position: relative;
|
||||
z-index: 1000;
|
||||
|
||||
height: 3.75rem;
|
||||
box-shadow: 0 1px 0 0 rgb(0 0 0 / .1);
|
||||
background: $white;
|
||||
|
||||
.btn-outline-primary {
|
||||
border-color: $white;
|
||||
}
|
||||
|
||||
.logo {
|
||||
display: block;
|
||||
box-sizing: content-box;
|
||||
position: relative;
|
||||
top: -.05em;
|
||||
height: 1.75rem;
|
||||
padding: $spacer 0;
|
||||
margin-right: $spacer;
|
||||
|
||||
img {
|
||||
display: block;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.course-title-lockup {
|
||||
@media only screen and (min-width: 769px) {
|
||||
padding: .5rem;
|
||||
padding-right: $spacer;
|
||||
border-right: 1px solid #E5E5E5;
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
overflow: hidden;
|
||||
|
||||
span {
|
||||
color: #333333;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
line-height: 1.375rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,6 +69,7 @@ const props = {
|
||||
},
|
||||
],
|
||||
outlineLink: 'tEsTLInK',
|
||||
searchButtonAction: null,
|
||||
};
|
||||
|
||||
describe('Header', () => {
|
||||
@@ -138,6 +139,20 @@ describe('Header', () => {
|
||||
|
||||
expect(desktopMenu).toBeNull();
|
||||
});
|
||||
|
||||
it('should show search button', async () => {
|
||||
const testProps = { ...props, searchButtonAction: () => undefined };
|
||||
const { getByRole } = render(<RootWrapper {...testProps} />);
|
||||
const searchButton = getByRole('button', { name: 'Search content' });
|
||||
|
||||
expect(searchButton).toBeVisible();
|
||||
});
|
||||
|
||||
it('should not show search button', async () => {
|
||||
const testProps = { ...props, searchButtonAction: null };
|
||||
const { queryByRole } = render(<RootWrapper {...testProps} />);
|
||||
expect(queryByRole('button', { name: 'Search content' })).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('mobile', () => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
||||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||
import {
|
||||
Avatar,
|
||||
} from '@edx/paragon';
|
||||
} from '@openedx/paragon';
|
||||
import NavDropdownMenu from './NavDropdownMenu';
|
||||
import getUserMenuItems from './utils';
|
||||
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
// This SCSS was partly copied from edx/frontend-app-support-tools/src/support-header/index.scss.
|
||||
$spacer: 1rem;
|
||||
$white: #FFFFFF;
|
||||
|
||||
.btn-tertiary:hover {
|
||||
color: white;
|
||||
background-color: #00262B;
|
||||
}
|
||||
|
||||
.course-title-lockup {
|
||||
@media only screen and (max-width: 768px) {
|
||||
padding-left: .5rem;
|
||||
max-width: 70%;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 769px) {
|
||||
padding: .5rem;
|
||||
padding-right: $spacer;
|
||||
border-right: 1px solid #E5E5E5;
|
||||
min-width: 70%;
|
||||
}
|
||||
|
||||
overflow: hidden;
|
||||
|
||||
span {
|
||||
color: #333333;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
line-height: 1.375rem;
|
||||
}
|
||||
}
|
||||
|
||||
.site-header-mobile,
|
||||
.site-header-desktop {
|
||||
position: relative;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.site-header-mobile {img {
|
||||
height: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.site-header-desktop {
|
||||
height: 3.75rem;
|
||||
box-shadow: 0 1px 0 0 rgb(0 0 0 / .1);
|
||||
background: $white;
|
||||
|
||||
.logo {
|
||||
display: block;
|
||||
box-sizing: content-box;
|
||||
position: relative;
|
||||
top: -.05em;
|
||||
height: 1.75rem;
|
||||
padding: $spacer 0;
|
||||
margin-right: $spacer;
|
||||
|
||||
img {
|
||||
display: block;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,106 +1,6 @@
|
||||
import { defineMessages } from '@edx/frontend-platform/i18n';
|
||||
|
||||
const messages = defineMessages({
|
||||
'header.links.content': {
|
||||
id: 'header.links.content',
|
||||
defaultMessage: 'Content',
|
||||
description: 'Label for Content menu trigger',
|
||||
},
|
||||
'header.links.settings': {
|
||||
id: 'header.links.settings',
|
||||
defaultMessage: 'Settings',
|
||||
description: 'Label for Settings menu trigger',
|
||||
},
|
||||
'header.links.tools': {
|
||||
id: 'header.links.content.tools',
|
||||
defaultMessage: 'Tools',
|
||||
description: 'Label for Tools menu trigger',
|
||||
},
|
||||
'header.links.outline': {
|
||||
id: 'header.links.outline',
|
||||
defaultMessage: 'Outline',
|
||||
description: 'Link to Studio Outline page',
|
||||
},
|
||||
'header.links.updates': {
|
||||
id: 'header.links.updates',
|
||||
defaultMessage: 'Updates',
|
||||
description: 'Link to Studio Updates page',
|
||||
},
|
||||
'header.links.pages': {
|
||||
id: 'header.links.pages',
|
||||
defaultMessage: 'Pages & Resources',
|
||||
description: 'Link to Studio Pages page',
|
||||
},
|
||||
'header.links.filesAndUploads': {
|
||||
id: 'header.links.filesAndUploads',
|
||||
defaultMessage: 'Files & Uploads',
|
||||
description: 'Link to Studio Files & Uploads page',
|
||||
},
|
||||
'header.links.textbooks': {
|
||||
id: 'header.links.textbooks',
|
||||
defaultMessage: 'Textbooks',
|
||||
description: 'Link to Studio Textbooks page',
|
||||
},
|
||||
'header.links.videoUploads': {
|
||||
id: 'header.links.videoUploads',
|
||||
defaultMessage: 'Video Uploads',
|
||||
description: 'Link to Studio Video Uploads page',
|
||||
},
|
||||
'header.links.scheduleAndDetails': {
|
||||
id: 'header.links.scheduleAndDetails',
|
||||
defaultMessage: 'Schedule & Details',
|
||||
description: 'Link to Studio Schedule & Details page',
|
||||
},
|
||||
'header.links.grading': {
|
||||
id: 'header.links.grading',
|
||||
defaultMessage: 'Grading',
|
||||
description: 'Link to Studio Grading page',
|
||||
},
|
||||
'header.links.courseTeam': {
|
||||
id: 'header.links.courseTeam',
|
||||
defaultMessage: 'Course Team',
|
||||
description: 'Link to Studio Course Team page',
|
||||
},
|
||||
'header.links.groupConfigurations': {
|
||||
id: 'header.links.groupConfigurations',
|
||||
defaultMessage: 'Group Configurations',
|
||||
description: 'Link to Studio Group Configurations page',
|
||||
},
|
||||
'header.links.proctoredExamSettings': {
|
||||
id: 'header.links.proctoredExamSettings',
|
||||
defaultMessage: 'Proctored Exam Settings',
|
||||
description: 'Link to Studio Proctored Exam Settings page',
|
||||
},
|
||||
'header.links.advancedSettings': {
|
||||
id: 'header.links.advancedSettings',
|
||||
defaultMessage: 'Advanced Settings',
|
||||
description: 'Link to Studio Advanced Settings page',
|
||||
},
|
||||
'header.links.certificates': {
|
||||
id: 'header.links.certificates',
|
||||
defaultMessage: 'Certificates',
|
||||
description: 'Link to Studio Certificates page',
|
||||
},
|
||||
'header.links.publisher': {
|
||||
id: 'header.links.publisher',
|
||||
defaultMessage: 'Publisher',
|
||||
description: 'Link to Publisher',
|
||||
},
|
||||
'header.links.import': {
|
||||
id: 'header.links.import',
|
||||
defaultMessage: 'Import',
|
||||
description: 'Link to Studio Import page',
|
||||
},
|
||||
'header.links.export': {
|
||||
id: 'header.links.export',
|
||||
defaultMessage: 'Export',
|
||||
description: 'Link to Studio Export page',
|
||||
},
|
||||
'header.links.checklists': {
|
||||
id: 'header.links.checklists',
|
||||
defaultMessage: 'Checklists',
|
||||
description: 'Link to Studio Checklists page',
|
||||
},
|
||||
'header.user.menu.studio': {
|
||||
id: 'header.user.menu.studio',
|
||||
defaultMessage: 'Studio Home',
|
||||
@@ -151,6 +51,11 @@ const messages = defineMessages({
|
||||
defaultMessage: 'Back to course outline in Studio',
|
||||
description: 'The aria label for the link back to the Studio Course Outline',
|
||||
},
|
||||
'header.label.search.nav': {
|
||||
id: 'header.label.search.nav',
|
||||
defaultMessage: 'Search content',
|
||||
description: 'The aria label for the search content button nav',
|
||||
},
|
||||
});
|
||||
|
||||
export default messages;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const path = require('path');
|
||||
const { createConfig } = require('@edx/frontend-build');
|
||||
const { createConfig } = require('@openedx/frontend-build');
|
||||
|
||||
module.exports = createConfig('webpack-dev', {
|
||||
entry: path.resolve(__dirname, 'example'),
|
||||
|
||||
Reference in New Issue
Block a user