Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61ecf93785 | ||
|
|
917e748fc5 | ||
|
|
0d64b19ac4 | ||
|
|
9415709b81 | ||
|
|
003d8ee1a7 | ||
|
|
18dd01d3d2 | ||
|
|
bdb1e03e4e | ||
|
|
5662e5daa3 | ||
|
|
9306ce0783 | ||
|
|
f58ef0ace6 | ||
|
|
7de6ba4381 | ||
|
|
14fe2d9bc6 |
26
.github/workflows/ci.yml
vendored
Normal file
26
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
name: Default CI
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup Nodejs
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
- name: Validate package-lock.json changes
|
||||||
|
run: make validate-no-uncommitted-package-lock-changes
|
||||||
|
- name: Lint
|
||||||
|
run: npm run lint
|
||||||
|
- name: Test
|
||||||
|
run: npm run test
|
||||||
|
- name: i18n_extract
|
||||||
|
run: npm run i18n_extract
|
||||||
|
- name: Coverage
|
||||||
|
uses: codecov/codecov-action@v1
|
||||||
37
.github/workflows/release.yml
vendored
Normal file
37
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
name: Release CI
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
- name: Validate package-lock.json changes
|
||||||
|
run: make validate-no-uncommitted-package-lock-changes
|
||||||
|
- name: Lint
|
||||||
|
run: npm run lint
|
||||||
|
- name: Test
|
||||||
|
run: npm run test
|
||||||
|
- name: i18n_extract
|
||||||
|
run: npm run i18n_extract
|
||||||
|
- name: Coverage
|
||||||
|
uses: codecov/codecov-action@v1
|
||||||
|
- name: Build
|
||||||
|
run: npm run build
|
||||||
|
- name: Release
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
|
||||||
|
NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
|
||||||
|
run: npx semantic-release
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,3 +6,4 @@ node_modules
|
|||||||
temp
|
temp
|
||||||
src/i18n/transifex_input.json
|
src/i18n/transifex_input.json
|
||||||
module.config.js
|
module.config.js
|
||||||
|
.idea/
|
||||||
|
|||||||
17
.travis.yml
17
.travis.yml
@@ -1,17 +0,0 @@
|
|||||||
language: node_js
|
|
||||||
node_js: 12
|
|
||||||
install:
|
|
||||||
- npm install
|
|
||||||
script:
|
|
||||||
- npm run lint
|
|
||||||
- npm run test
|
|
||||||
- npm run build
|
|
||||||
after_success:
|
|
||||||
- npx semantic-release
|
|
||||||
- codecov
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
# GH_TOKEN
|
|
||||||
- secure: CFN/uOByWC+7S+AAXECLQ0mNgoiyCDl1ZB5AT5+/qP+xEVs0ysFKDWrD9W8KeQqHqCMPUKNt23nrgxwvFCkSx+n1MAnxZmOdVJWbzGbUB9TsqrwVUALkqof1MrRB8UFVEzIRaO60iRN/L3zVXML+4GsycYX6rHyptbAypxplpljDyKrY8tc/mM7AGZ9eVFGSq+7CXXmdvkhP9kLkH1tIYvR7wjTKvZHbHf6YRjIVCiyzxM4S/E9l8JRnbERp02XosRD62PUJXXk6EJVn6Qoub6CaPnpew5crW0iRF1UJs54U29zWd/S+LuW66WkLfJu7rDq6AFJNMtMNusJxwVkOv4X+p0oJDWZEhojW+/Wm10UAu8/g5oAqeePZEGiSbT3Hp1VqOc4FY/kmOLiM+L6oq/AA2XX6iiE8lA64IH5R8ApQamF4GTUYTvKHeLPgXnGJH7A95Xy9/+jmX9I9wJREMrHrkyPjoX/NTRdG+RrebB1+An9Bt9vAbG862gbOZfgTcuWHDOlG5gcA964Fr7RqR5a62yr45Gw+Q0lTrLj5mGAjjSpMRIAQzi9e7oXmoMZnvenu/WJAe5M+u+/gv82HeXcMwLvNNGSvz+0i1xNUOoX1zHG046oGKiX0Zu+l0JfNwihJTO7vJlaITmjhfOyufwpk74xEyrhf8nLF9e5Frec=
|
|
||||||
# NPM_TOKEN
|
|
||||||
- secure: fuV04Ctf0mgbw6nTJhsTzGZ6dyafZtGVj30ZkvSWsB9hUU8KDtl7wWVW9EayCQsSyyFgPY9RVav5olgC/zljAjDGg0nfF7n8uKIABA0TXdP683WZd06bVOmDXfL26B3yM83aW2xgHZN6VCCvCE8bLP1V6eV8nsr38gDgxVbHa0YasDMmvtYrog+IjxwjcJx7fD0RbYyi7iJC++pdw9kcFqOad28Us7L/jCn+rC3CmUT4kOwPjP5g1v5sB2FA7ouN5s1hUUTKuttV32VJgRP7wbZzoHeHX5BRGSqijdXNSaK5UwzqRnM1sGZkuNDZhJbSB3q90SQrPRgV+fRizwN8zs8Htb+Kk8+wGY6zNhmi9C+lUIv7UpDYbstMWYIf39+P/24Oj+vJBjMY30M9NWB8gt1OQ0dJUoK53v1+BMVmDB0doL6I53xwzUjQetvqOF0Wm3E3OrqJP00OJdzIcAeh2DzcIRW1SrBhI4HAsl7QJZNpRw11QzJ3K2iQSiWNd8qIuX+XJjzQdn1v09gCstvbP33Vn8tP1x0XTSi8wIhTDqE0bII/Sc80Jh76nu0ItQ8pmX4lGsER4C0N3Dp7Zz51yW7E70AWWLsUrMNdF0oHoP437ZRGPhYs5OI6x5AM2jlU8fJ5aUroEsYFCwkH0OO37THohpAQpApe9zL10miTEbw=
|
|
||||||
37
package-lock.json
generated
37
package-lock.json
generated
@@ -1660,13 +1660,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@edx/frontend-platform": {
|
"@edx/frontend-platform": {
|
||||||
"version": "1.8.0",
|
"version": "1.8.1",
|
||||||
"resolved": "https://registry.npmjs.org/@edx/frontend-platform/-/frontend-platform-1.8.0.tgz",
|
"resolved": "https://registry.npmjs.org/@edx/frontend-platform/-/frontend-platform-1.8.1.tgz",
|
||||||
"integrity": "sha512-R4LGBKaSBWC9xxG3eTN78zw5CkBes4xQgazt78ApgenxzIoun+y0tdWyc/8PpjbKmyj0nACpsfARyeQy4rnGKA==",
|
"integrity": "sha512-oHLSamyIDuCtdS7eDzLcYs4zsAOGf4uuywnnIKg1CnlEHzUrXnfmcajbNM3Wre5jJocGH+1qACuaGLELO+3sAQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@cospired/i18n-iso-languages": "2.1.2",
|
"@cospired/i18n-iso-languages": "2.1.2",
|
||||||
"axios": "0.18.1",
|
"axios": "0.21.1",
|
||||||
"axios-cache-adapter": "^2.5.0",
|
"axios-cache-adapter": "^2.5.0",
|
||||||
"form-urlencoded": "4.1.4",
|
"form-urlencoded": "4.1.4",
|
||||||
"glob": "7.1.6",
|
"glob": "7.1.6",
|
||||||
@@ -4294,13 +4294,20 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"axios": {
|
"axios": {
|
||||||
"version": "0.18.1",
|
"version": "0.21.1",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.18.1.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
|
||||||
"integrity": "sha512-0BfJq4NSfQXd+SkFdrvFbG7addhYSBA2mQwISr46pD6E5iqkWg02RAs8vyTT/j0RTnoYmeXauBuSv1qKwR179g==",
|
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"follow-redirects": "1.5.10",
|
"follow-redirects": "^1.10.0"
|
||||||
"is-buffer": "^2.0.2"
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"follow-redirects": {
|
||||||
|
"version": "1.13.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.1.tgz",
|
||||||
|
"integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"axios-cache-adapter": {
|
"axios-cache-adapter": {
|
||||||
@@ -11687,12 +11694,6 @@
|
|||||||
"integrity": "sha1-mPiygDBoQhmpXzdc+9iM40Bd/5M=",
|
"integrity": "sha1-mPiygDBoQhmpXzdc+9iM40Bd/5M=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"is-buffer": {
|
|
||||||
"version": "2.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz",
|
|
||||||
"integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"is-callable": {
|
"is-callable": {
|
||||||
"version": "1.1.4",
|
"version": "1.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz",
|
||||||
@@ -17907,9 +17908,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"react-redux": {
|
"react-redux": {
|
||||||
"version": "7.1.1",
|
"version": "7.1.3",
|
||||||
"resolved": false,
|
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-7.1.3.tgz",
|
||||||
"integrity": "sha512-QsW0vcmVVdNQzEkrgzh2W3Ksvr8cqpAv5FhEk7tNEft+5pp7rXxAudTz3VOPawRkLIepItpkEIyLcN/VVXzjTg==",
|
"integrity": "sha512-uI1wca+ECG9RoVkWQFF4jDMqmaw0/qnvaSvOoL/GA4dNxf6LoV8sUAcNDvE5NWKs4hFpn0t6wswNQnY3f7HT3w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/runtime": "^7.5.5",
|
"@babel/runtime": "^7.5.5",
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
"@commitlint/prompt-cli": "8.2.0",
|
"@commitlint/prompt-cli": "8.2.0",
|
||||||
"@edx/brand": "npm:@edx/brand-openedx@1.1.0",
|
"@edx/brand": "npm:@edx/brand-openedx@1.1.0",
|
||||||
"@edx/frontend-build": "5.4.0",
|
"@edx/frontend-build": "5.4.0",
|
||||||
"@edx/frontend-platform": "1.8.0",
|
"@edx/frontend-platform": "1.8.1",
|
||||||
"@edx/paragon": "12.0.5",
|
"@edx/paragon": "12.0.5",
|
||||||
"codecov": "3.7.2",
|
"codecov": "3.7.2",
|
||||||
"enzyme": "3.10.0",
|
"enzyme": "3.10.0",
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
"prop-types": "15.7.2",
|
"prop-types": "15.7.2",
|
||||||
"react": "16.9.0",
|
"react": "16.9.0",
|
||||||
"react-dom": "16.9.0",
|
"react-dom": "16.9.0",
|
||||||
"react-redux": "7.1.1",
|
"react-redux": "7.1.3",
|
||||||
"react-router-dom": "5.1.2",
|
"react-router-dom": "5.1.2",
|
||||||
"react-test-renderer": "16.9.0",
|
"react-test-renderer": "16.9.0",
|
||||||
"reactifex": "1.1.1",
|
"reactifex": "1.1.1",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||||
|
import { getConfig } from '@edx/frontend-platform';
|
||||||
|
|
||||||
// Local Components
|
// Local Components
|
||||||
import { Menu, MenuTrigger, MenuContent } from './Menu';
|
import { Menu, MenuTrigger, MenuContent } from './Menu';
|
||||||
@@ -103,10 +104,11 @@ class DesktopHeader extends React.Component {
|
|||||||
intl,
|
intl,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const logoProps = { src: logo, alt: logoAltText, href: logoDestination };
|
const logoProps = { src: logo, alt: logoAltText, href: logoDestination };
|
||||||
|
const logoClasses = getConfig().AUTHN_MINIMAL_HEADER ? 'mw-100' : null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header className="site-header-desktop">
|
<header className="site-header-desktop">
|
||||||
<div className="container-fluid">
|
<div className={`container-fluid ${logoClasses}`}>
|
||||||
<div className="nav-container position-relative d-flex align-items-center">
|
<div className="nav-container position-relative d-flex align-items-center">
|
||||||
{logoDestination === null ? <Logo className="logo" src={logo} alt={logoAltText} /> : <LinkedLogo className="logo" {...logoProps} />}
|
{logoDestination === null ? <Logo className="logo" src={logo} alt={logoAltText} /> : <LinkedLogo className="logo" {...logoProps} />}
|
||||||
<nav
|
<nav
|
||||||
|
|||||||
@@ -20,12 +20,12 @@ ensureConfig([
|
|||||||
'LOGOUT_URL',
|
'LOGOUT_URL',
|
||||||
'LOGIN_URL',
|
'LOGIN_URL',
|
||||||
'SITE_NAME',
|
'SITE_NAME',
|
||||||
'LOGO_TRADEMARK_URL',
|
'LOGO_URL',
|
||||||
], 'Header component');
|
], 'Header component');
|
||||||
|
|
||||||
subscribe(APP_CONFIG_INITIALIZED, () => {
|
subscribe(APP_CONFIG_INITIALIZED, () => {
|
||||||
mergeConfig({
|
mergeConfig({
|
||||||
LOGISTRATION_MINIMAL_HEADER: !!process.env.LOGISTRATION_MINIMAL_HEADER,
|
AUTHN_MINIMAL_HEADER: !!process.env.AUTHN_MINIMAL_HEADER,
|
||||||
}, 'Header additional config');
|
}, 'Header additional config');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -77,16 +77,16 @@ function Header({ intl }) {
|
|||||||
];
|
];
|
||||||
|
|
||||||
const props = {
|
const props = {
|
||||||
logo: config.LOGO_TRADEMARK_URL,
|
logo: config.LOGO_URL,
|
||||||
logoAltText: config.SITE_NAME,
|
logoAltText: config.SITE_NAME,
|
||||||
siteName: config.SITE_NAME,
|
siteName: config.SITE_NAME,
|
||||||
logoDestination: `${config.LMS_BASE_URL}/dashboard`,
|
logoDestination: `${config.LMS_BASE_URL}/dashboard`,
|
||||||
loggedIn: authenticatedUser !== null,
|
loggedIn: authenticatedUser !== null,
|
||||||
username: authenticatedUser !== null ? authenticatedUser.username : null,
|
username: authenticatedUser !== null ? authenticatedUser.username : null,
|
||||||
avatar: authenticatedUser !== null ? authenticatedUser.avatar : null,
|
avatar: authenticatedUser !== null ? authenticatedUser.avatar : null,
|
||||||
mainMenu: getConfig().LOGISTRATION_MINIMAL_HEADER ? [] : mainMenu,
|
mainMenu: getConfig().AUTHN_MINIMAL_HEADER ? [] : mainMenu,
|
||||||
userMenu,
|
userMenu: getConfig().AUTHN_MINIMAL_HEADER ? [] : userMenu,
|
||||||
loggedOutItems: getConfig().LOGISTRATION_MINIMAL_HEADER ? [] : loggedOutItems,
|
loggedOutItems: getConfig().AUTHN_MINIMAL_HEADER ? [] : loggedOutItems,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ const messages = defineMessages({
|
|||||||
description: 'The aria label for the account menu trigger',
|
description: 'The aria label for the account menu trigger',
|
||||||
},
|
},
|
||||||
'header.label.account.menu.for': {
|
'header.label.account.menu.for': {
|
||||||
id: 'header.label.account.menu',
|
id: 'header.label.account.menu.for',
|
||||||
defaultMessage: 'Account menu for {username}',
|
defaultMessage: 'Account menu for {username}',
|
||||||
description: 'The aria label for the account menu trigger when the username is displayed in it',
|
description: 'The aria label for the account menu trigger when the username is displayed in it',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ describe('<Header />', () => {
|
|||||||
SITE_NAME: process.env.SITE_NAME,
|
SITE_NAME: process.env.SITE_NAME,
|
||||||
LOGIN_URL: process.env.LOGIN_URL,
|
LOGIN_URL: process.env.LOGIN_URL,
|
||||||
LOGOUT_URL: process.env.LOGOUT_URL,
|
LOGOUT_URL: process.env.LOGOUT_URL,
|
||||||
LOGO_TRADEMARK_URL: process.env.LOGO_TRADEMARK_URL,
|
LOGO_URL: process.env.LOGO_URL,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -51,7 +51,7 @@ describe('<Header />', () => {
|
|||||||
SITE_NAME: process.env.SITE_NAME,
|
SITE_NAME: process.env.SITE_NAME,
|
||||||
LOGIN_URL: process.env.LOGIN_URL,
|
LOGIN_URL: process.env.LOGIN_URL,
|
||||||
LOGOUT_URL: process.env.LOGOUT_URL,
|
LOGOUT_URL: process.env.LOGOUT_URL,
|
||||||
LOGO_TRADEMARK_URL: process.env.LOGO_TRADEMARK_URL,
|
LOGO_URL: process.env.LOGO_URL,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -78,7 +78,7 @@ describe('<Header />', () => {
|
|||||||
SITE_NAME: process.env.SITE_NAME,
|
SITE_NAME: process.env.SITE_NAME,
|
||||||
LOGIN_URL: process.env.LOGIN_URL,
|
LOGIN_URL: process.env.LOGIN_URL,
|
||||||
LOGOUT_URL: process.env.LOGOUT_URL,
|
LOGOUT_URL: process.env.LOGOUT_URL,
|
||||||
LOGO_TRADEMARK_URL: process.env.LOGO_TRADEMARK_URL,
|
LOGO_URL: process.env.LOGO_URL,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -110,7 +110,7 @@ describe('<Header />', () => {
|
|||||||
SITE_NAME: process.env.SITE_NAME,
|
SITE_NAME: process.env.SITE_NAME,
|
||||||
LOGIN_URL: process.env.LOGIN_URL,
|
LOGIN_URL: process.env.LOGIN_URL,
|
||||||
LOGOUT_URL: process.env.LOGOUT_URL,
|
LOGOUT_URL: process.env.LOGOUT_URL,
|
||||||
LOGO_TRADEMARK_URL: process.env.LOGO_TRADEMARK_URL,
|
LOGO_URL: process.env.LOGO_URL,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||||
|
import { getConfig } from '@edx/frontend-platform';
|
||||||
|
|
||||||
// Local Components
|
// Local Components
|
||||||
import { Menu, MenuTrigger, MenuContent } from './Menu';
|
import { Menu, MenuTrigger, MenuContent } from './Menu';
|
||||||
@@ -91,17 +92,21 @@ class MobileHeader extends React.Component {
|
|||||||
stickyOnMobile,
|
stickyOnMobile,
|
||||||
intl,
|
intl,
|
||||||
mainMenu,
|
mainMenu,
|
||||||
|
userMenu,
|
||||||
|
loggedOutItems,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const logoProps = { src: logo, alt: logoAltText, href: logoDestination };
|
const logoProps = { src: logo, alt: logoAltText, href: logoDestination };
|
||||||
const stickyClassName = stickyOnMobile ? 'sticky-top' : '';
|
const stickyClassName = stickyOnMobile ? 'sticky-top' : '';
|
||||||
|
const logoClasses = getConfig().AUTHN_MINIMAL_HEADER ? 'justify-content-left pl-3' : 'justify-content-center';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header
|
<header
|
||||||
aria-label={intl.formatMessage(messages['header.label.main.header'])}
|
aria-label={intl.formatMessage(messages['header.label.main.header'])}
|
||||||
className={`site-header-mobile d-flex justify-content-between align-items-center shadow ${stickyClassName}`}
|
className={`site-header-mobile d-flex justify-content-between align-items-center shadow ${stickyClassName}`}
|
||||||
>
|
>
|
||||||
<div className="w-100 d-flex justify-content-start">
|
{mainMenu.length > 0 ? (
|
||||||
{mainMenu.length > 0 ? (
|
<div className="w-100 d-flex justify-content-start">
|
||||||
|
|
||||||
<Menu className="position-static">
|
<Menu className="position-static">
|
||||||
<MenuTrigger
|
<MenuTrigger
|
||||||
tag="button"
|
tag="button"
|
||||||
@@ -119,26 +124,28 @@ class MobileHeader extends React.Component {
|
|||||||
{this.renderMainMenu()}
|
{this.renderMainMenu()}
|
||||||
</MenuContent>
|
</MenuContent>
|
||||||
</Menu>
|
</Menu>
|
||||||
) : null}
|
</div>
|
||||||
</div>
|
) : null}
|
||||||
<div className="w-100 d-flex justify-content-center">
|
<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" />}
|
{ logoDestination === null ? <Logo className="logo" src={logo} alt={logoAltText} /> : <LinkedLogo className="logo" {...logoProps} itemType="http://schema.org/Organization" />}
|
||||||
</div>
|
</div>
|
||||||
<div className="w-100 d-flex justify-content-end align-items-center">
|
{userMenu.length > 0 || loggedOutItems.length > 0 ? (
|
||||||
<Menu tag="nav" aria-label={intl.formatMessage(messages['header.label.secondary.nav'])} className="position-static">
|
<div className="w-100 d-flex justify-content-end align-items-center">
|
||||||
<MenuTrigger
|
<Menu tag="nav" aria-label={intl.formatMessage(messages['header.label.secondary.nav'])} className="position-static">
|
||||||
tag="button"
|
<MenuTrigger
|
||||||
className="icon-button"
|
tag="button"
|
||||||
aria-label={intl.formatMessage(messages['header.label.account.menu'])}
|
className="icon-button"
|
||||||
title={intl.formatMessage(messages['header.label.account.menu'])}
|
aria-label={intl.formatMessage(messages['header.label.account.menu'])}
|
||||||
>
|
title={intl.formatMessage(messages['header.label.account.menu'])}
|
||||||
<Avatar size="1.5rem" src={avatar} alt={username} />
|
>
|
||||||
</MenuTrigger>
|
<Avatar size="1.5rem" src={avatar} alt={username} />
|
||||||
<MenuContent tag="ul" className="nav flex-column pin-left pin-right border-top shadow py-2">
|
</MenuTrigger>
|
||||||
{loggedIn ? this.renderUserMenuItems() : this.renderLoggedOutItems()}
|
<MenuContent tag="ul" className="nav flex-column pin-left pin-right border-top shadow py-2">
|
||||||
</MenuContent>
|
{loggedIn ? this.renderUserMenuItems() : this.renderLoggedOutItems()}
|
||||||
</Menu>
|
</MenuContent>
|
||||||
</div>
|
</Menu>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
</header>
|
</header>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ exports[`<Header /> renders correctly for anonymous desktop 1`] = `
|
|||||||
className="site-header-desktop"
|
className="site-header-desktop"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="container-fluid"
|
className="container-fluid null"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="nav-container position-relative d-flex align-items-center"
|
className="nav-container position-relative d-flex align-items-center"
|
||||||
@@ -17,7 +17,7 @@ exports[`<Header /> renders correctly for anonymous desktop 1`] = `
|
|||||||
<img
|
<img
|
||||||
alt="edX"
|
alt="edX"
|
||||||
className="d-block"
|
className="d-block"
|
||||||
src="https://edx-cdn.org/v3/default/logo-trademark.svg"
|
src="https://edx-cdn.org/v3/default/logo.svg"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
<nav
|
<nav
|
||||||
@@ -126,7 +126,7 @@ exports[`<Header /> renders correctly for anonymous mobile 1`] = `
|
|||||||
<img
|
<img
|
||||||
alt="edX"
|
alt="edX"
|
||||||
className="d-block"
|
className="d-block"
|
||||||
src="https://edx-cdn.org/v3/default/logo-trademark.svg"
|
src="https://edx-cdn.org/v3/default/logo.svg"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -189,7 +189,7 @@ exports[`<Header /> renders correctly for authenticated desktop 1`] = `
|
|||||||
className="site-header-desktop"
|
className="site-header-desktop"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="container-fluid"
|
className="container-fluid null"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="nav-container position-relative d-flex align-items-center"
|
className="nav-container position-relative d-flex align-items-center"
|
||||||
@@ -201,7 +201,7 @@ exports[`<Header /> renders correctly for authenticated desktop 1`] = `
|
|||||||
<img
|
<img
|
||||||
alt="edX"
|
alt="edX"
|
||||||
className="d-block"
|
className="d-block"
|
||||||
src="https://edx-cdn.org/v3/default/logo-trademark.svg"
|
src="https://edx-cdn.org/v3/default/logo.svg"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
<nav
|
<nav
|
||||||
@@ -360,7 +360,7 @@ exports[`<Header /> renders correctly for authenticated mobile 1`] = `
|
|||||||
<img
|
<img
|
||||||
alt="edX"
|
alt="edX"
|
||||||
className="d-block"
|
className="d-block"
|
||||||
src="https://edx-cdn.org/v3/default/logo-trademark.svg"
|
src="https://edx-cdn.org/v3/default/logo.svg"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ $white: #fff;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.site-header-mobile {
|
.site-header-mobile {
|
||||||
|
height: 3rem;
|
||||||
|
|
||||||
.nav-link {
|
.nav-link {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|||||||
Reference in New Issue
Block a user