@nauedu/frontend-component-header 20.0.0 → 20.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -17,6 +17,7 @@ import { AppContext } from '@edx/frontend-platform/react';
|
|
|
17
17
|
import AnonymousUserMenu from './AnonymousUserMenu';
|
|
18
18
|
import AuthenticatedUserDropdown from './AuthenticatedUserDropdown';
|
|
19
19
|
import LogoSlot from '../plugin-slots/LogoSlot';
|
|
20
|
+
import LearningHelpSlot from '../plugin-slots/LearningHelpSlot';
|
|
20
21
|
import messages from './messages';
|
|
21
22
|
import getCourseLogoOrg from './data/api';
|
|
22
23
|
import LanguageSelector from '../LanguageSelector';
|
|
@@ -109,9 +110,9 @@ var LearningHeader = function LearningHeader(_ref2) {
|
|
|
109
110
|
options: JSON.parse(getConfig().SITE_SUPPORTED_LANGUAGES),
|
|
110
111
|
compact: false,
|
|
111
112
|
authenticatedUser: authenticatedUser
|
|
112
|
-
}))), showUserDropdown && authenticatedUser && /*#__PURE__*/React.createElement(AuthenticatedUserDropdown, {
|
|
113
|
+
}))), showUserDropdown && authenticatedUser && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LearningHelpSlot, null), /*#__PURE__*/React.createElement(AuthenticatedUserDropdown, {
|
|
113
114
|
username: authenticatedUser.username
|
|
114
|
-
}), showUserDropdown && !authenticatedUser && /*#__PURE__*/React.createElement(AnonymousUserMenu, null))));
|
|
115
|
+
})), showUserDropdown && !authenticatedUser && /*#__PURE__*/React.createElement(AnonymousUserMenu, null))));
|
|
115
116
|
};
|
|
116
117
|
LearningHeader.propTypes = {
|
|
117
118
|
courseOrg: PropTypes.string,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LearningHeader.js","names":["React","useContext","useEffect","useState","Responsive","PropTypes","getConfig","injectIntl","intlShape","AppContext","AnonymousUserMenu","AuthenticatedUserDropdown","LogoSlot","messages","getCourseLogoOrg","LanguageSelector","LinkedLogo","_ref","href","src","alt","attributes","_objectWithoutProperties","_excluded","createElement","_extends","className","propTypes","string","isRequired","LearningHeader","_ref2","courseOrg","courseTitle","intl","showUserDropdown","_useContext","authenticatedUser","_useState","_useState2","_slicedToArray","logoOrg","setLogoOrg","enableOrgLogo","ENABLE_ORG_LOGO","then","logoOrgUrl","headerLogo","Fragment","maxWidth","concat","LMS_BASE_URL","LOGO_URL_MOBILE","LOGO_URL","SITE_NAME","minWidth","formatMessage","skipNavLink","style","maxHeight","fontSize","ENABLE_HEADER_LANG_SELECTOR","options","JSON","parse","SITE_SUPPORTED_LANGUAGES","compact","username","bool","defaultProps"],"sources":["../../src/learning-header/LearningHeader.jsx"],"sourcesContent":["import React, { useContext, useEffect, useState } from 'react';\nimport Responsive from 'react-responsive';\nimport PropTypes from 'prop-types';\nimport { getConfig } from '@edx/frontend-platform';\nimport { injectIntl, intlShape } from '@edx/frontend-platform/i18n';\nimport { AppContext } from '@edx/frontend-platform/react';\n\nimport AnonymousUserMenu from './AnonymousUserMenu';\nimport AuthenticatedUserDropdown from './AuthenticatedUserDropdown';\nimport LogoSlot from '../plugin-slots/LogoSlot';\nimport messages from './messages';\nimport getCourseLogoOrg from './data/api';\nimport LanguageSelector from '../LanguageSelector';\n\nconst LinkedLogo = ({\n href,\n src,\n alt,\n ...attributes\n}) => (\n <a href={href} {...attributes}>\n <img className=\"d-block\" src={src} alt={alt} />\n </a>\n);\n\nLinkedLogo.propTypes = {\n href: PropTypes.string.isRequired,\n src: PropTypes.string.isRequired,\n alt: PropTypes.string.isRequired,\n};\nconst LearningHeader = ({\n courseOrg, courseTitle, intl, showUserDropdown,\n}) => {\n const { authenticatedUser } = useContext(AppContext);\n const [logoOrg, setLogoOrg] = useState(null);\n const enableOrgLogo = getConfig().ENABLE_ORG_LOGO;\n\n useEffect(() => {\n if (courseOrg && enableOrgLogo) {\n getCourseLogoOrg().then((logoOrgUrl) => { setLogoOrg(logoOrgUrl); });\n }\n }, [courseOrg, enableOrgLogo]);\n\n const headerLogo = (\n <>\n <Responsive maxWidth={769}>\n <LogoSlot\n href={`${getConfig().LMS_BASE_URL}/dashboard`}\n src={getConfig().LOGO_URL_MOBILE || getConfig().LOGO_URL}\n alt={getConfig().SITE_NAME}\n />\n </Responsive>\n <Responsive minWidth={769}>\n <LogoSlot\n href={`${getConfig().LMS_BASE_URL}/dashboard`}\n src={getConfig().LOGO_URL}\n alt={getConfig().SITE_NAME}\n />\n </Responsive>\n </>\n );\n\n return (\n <header className=\"learning-header\">\n <a className=\"sr-only sr-only-focusable\" href=\"#main-content\">{intl.formatMessage(messages.skipNavLink)}</a>\n <div className=\"container-xl py-2 d-flex align-items-center justify-content-between\">\n {headerLogo}\n <div className=\"d-none d-md-block flex-grow-1 course-title-lockup\">\n <div className={`d-md-flex ${enableOrgLogo && 'align-items-center justify-content-center'} w-100`}>\n {enableOrgLogo && courseOrg && logoOrg && (\n <img src={logoOrg} alt={`${courseOrg} logo`} style={{ maxHeight: '3rem', maxWidth: '15rem' }} />\n )}\n <span\n className=\"d-inline-block course-title font-weight-semibold ml-3 text-truncate text-left\"\n style={{ fontSize: '1rem' }}\n >\n {courseTitle}\n </span>\n </div>\n </div>\n <div className=\"d-flex align-items-center\">\n {getConfig().ENABLE_HEADER_LANG_SELECTOR && (\n <div className=\"mx-2 d-md-inline-flex\">\n <Responsive maxWidth={1200}>\n <LanguageSelector\n options={JSON.parse(getConfig().SITE_SUPPORTED_LANGUAGES)}\n compact\n authenticatedUser={authenticatedUser}\n />\n </Responsive>\n <Responsive minWidth={1200}>\n <LanguageSelector\n options={JSON.parse(getConfig().SITE_SUPPORTED_LANGUAGES)}\n compact={false}\n authenticatedUser={authenticatedUser}\n />\n </Responsive>\n </div>\n )}\n {showUserDropdown && authenticatedUser && (\n <AuthenticatedUserDropdown\n
|
|
1
|
+
{"version":3,"file":"LearningHeader.js","names":["React","useContext","useEffect","useState","Responsive","PropTypes","getConfig","injectIntl","intlShape","AppContext","AnonymousUserMenu","AuthenticatedUserDropdown","LogoSlot","LearningHelpSlot","messages","getCourseLogoOrg","LanguageSelector","LinkedLogo","_ref","href","src","alt","attributes","_objectWithoutProperties","_excluded","createElement","_extends","className","propTypes","string","isRequired","LearningHeader","_ref2","courseOrg","courseTitle","intl","showUserDropdown","_useContext","authenticatedUser","_useState","_useState2","_slicedToArray","logoOrg","setLogoOrg","enableOrgLogo","ENABLE_ORG_LOGO","then","logoOrgUrl","headerLogo","Fragment","maxWidth","concat","LMS_BASE_URL","LOGO_URL_MOBILE","LOGO_URL","SITE_NAME","minWidth","formatMessage","skipNavLink","style","maxHeight","fontSize","ENABLE_HEADER_LANG_SELECTOR","options","JSON","parse","SITE_SUPPORTED_LANGUAGES","compact","username","bool","defaultProps"],"sources":["../../src/learning-header/LearningHeader.jsx"],"sourcesContent":["import React, { useContext, useEffect, useState } from 'react';\nimport Responsive from 'react-responsive';\nimport PropTypes from 'prop-types';\nimport { getConfig } from '@edx/frontend-platform';\nimport { injectIntl, intlShape } from '@edx/frontend-platform/i18n';\nimport { AppContext } from '@edx/frontend-platform/react';\n\nimport AnonymousUserMenu from './AnonymousUserMenu';\nimport AuthenticatedUserDropdown from './AuthenticatedUserDropdown';\nimport LogoSlot from '../plugin-slots/LogoSlot';\nimport LearningHelpSlot from '../plugin-slots/LearningHelpSlot';\nimport messages from './messages';\nimport getCourseLogoOrg from './data/api';\nimport LanguageSelector from '../LanguageSelector';\n\nconst LinkedLogo = ({\n href,\n src,\n alt,\n ...attributes\n}) => (\n <a href={href} {...attributes}>\n <img className=\"d-block\" src={src} alt={alt} />\n </a>\n);\n\nLinkedLogo.propTypes = {\n href: PropTypes.string.isRequired,\n src: PropTypes.string.isRequired,\n alt: PropTypes.string.isRequired,\n};\nconst LearningHeader = ({\n courseOrg, courseTitle, intl, showUserDropdown,\n}) => {\n const { authenticatedUser } = useContext(AppContext);\n const [logoOrg, setLogoOrg] = useState(null);\n const enableOrgLogo = getConfig().ENABLE_ORG_LOGO;\n\n useEffect(() => {\n if (courseOrg && enableOrgLogo) {\n getCourseLogoOrg().then((logoOrgUrl) => { setLogoOrg(logoOrgUrl); });\n }\n }, [courseOrg, enableOrgLogo]);\n\n const headerLogo = (\n <>\n <Responsive maxWidth={769}>\n <LogoSlot\n href={`${getConfig().LMS_BASE_URL}/dashboard`}\n src={getConfig().LOGO_URL_MOBILE || getConfig().LOGO_URL}\n alt={getConfig().SITE_NAME}\n />\n </Responsive>\n <Responsive minWidth={769}>\n <LogoSlot\n href={`${getConfig().LMS_BASE_URL}/dashboard`}\n src={getConfig().LOGO_URL}\n alt={getConfig().SITE_NAME}\n />\n </Responsive>\n </>\n );\n\n return (\n <header className=\"learning-header\">\n <a className=\"sr-only sr-only-focusable\" href=\"#main-content\">{intl.formatMessage(messages.skipNavLink)}</a>\n <div className=\"container-xl py-2 d-flex align-items-center justify-content-between\">\n {headerLogo}\n <div className=\"d-none d-md-block flex-grow-1 course-title-lockup\">\n <div className={`d-md-flex ${enableOrgLogo && 'align-items-center justify-content-center'} w-100`}>\n {enableOrgLogo && courseOrg && logoOrg && (\n <img src={logoOrg} alt={`${courseOrg} logo`} style={{ maxHeight: '3rem', maxWidth: '15rem' }} />\n )}\n <span\n className=\"d-inline-block course-title font-weight-semibold ml-3 text-truncate text-left\"\n style={{ fontSize: '1rem' }}\n >\n {courseTitle}\n </span>\n </div>\n </div>\n <div className=\"d-flex align-items-center\">\n {getConfig().ENABLE_HEADER_LANG_SELECTOR && (\n <div className=\"mx-2 d-md-inline-flex\">\n <Responsive maxWidth={1200}>\n <LanguageSelector\n options={JSON.parse(getConfig().SITE_SUPPORTED_LANGUAGES)}\n compact\n authenticatedUser={authenticatedUser}\n />\n </Responsive>\n <Responsive minWidth={1200}>\n <LanguageSelector\n options={JSON.parse(getConfig().SITE_SUPPORTED_LANGUAGES)}\n compact={false}\n authenticatedUser={authenticatedUser}\n />\n </Responsive>\n </div>\n )}\n {showUserDropdown && authenticatedUser && (\n <>\n <LearningHelpSlot />\n <AuthenticatedUserDropdown\n username={authenticatedUser.username}\n />\n </>\n )}\n {showUserDropdown && !authenticatedUser && (\n <AnonymousUserMenu />\n )}\n </div>\n </div>\n </header>\n );\n};\n\nLearningHeader.propTypes = {\n courseOrg: PropTypes.string,\n courseTitle: PropTypes.string,\n intl: intlShape.isRequired,\n showUserDropdown: PropTypes.bool,\n};\n\nLearningHeader.defaultProps = {\n courseOrg: null,\n courseTitle: null,\n showUserDropdown: true,\n};\n\nexport default injectIntl(LearningHeader);\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC9D,OAAOC,UAAU,MAAM,kBAAkB;AACzC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,SAAS,QAAQ,wBAAwB;AAClD,SAASC,UAAU,EAAEC,SAAS,QAAQ,6BAA6B;AACnE,SAASC,UAAU,QAAQ,8BAA8B;AAEzD,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,OAAOC,yBAAyB,MAAM,6BAA6B;AACnE,OAAOC,QAAQ,MAAM,0BAA0B;AAC/C,OAAOC,gBAAgB,MAAM,kCAAkC;AAC/D,OAAOC,QAAQ,MAAM,YAAY;AACjC,OAAOC,gBAAgB,MAAM,YAAY;AACzC,OAAOC,gBAAgB,MAAM,qBAAqB;AAElD,IAAMC,UAAU,GAAG,SAAbA,UAAUA,CAAAC,IAAA;EAAA,IACdC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IACJC,GAAG,GAAAF,IAAA,CAAHE,GAAG;IACHC,GAAG,GAAAH,IAAA,CAAHG,GAAG;IACAC,UAAU,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA;EAAA,oBAEbxB,KAAA,CAAAyB,aAAA,MAAAC,QAAA;IAAGP,IAAI,EAAEA;EAAK,GAAKG,UAAU,gBAC3BtB,KAAA,CAAAyB,aAAA;IAAKE,SAAS,EAAC,SAAS;IAACP,GAAG,EAAEA,GAAI;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