@nauedu/frontend-component-header 18.1.2 → 18.2.0
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.
|
@@ -77,7 +77,7 @@ var LearningHeader = function LearningHeader(_ref2) {
|
|
|
77
77
|
className: "sr-only sr-only-focusable",
|
|
78
78
|
href: "#main-content"
|
|
79
79
|
}, intl.formatMessage(messages.skipNavLink)), /*#__PURE__*/React.createElement("div", {
|
|
80
|
-
className: "container-xl py-2 d-flex align-items-center"
|
|
80
|
+
className: "container-xl py-2 d-flex align-items-center justify-content-between"
|
|
81
81
|
}, headerLogo, /*#__PURE__*/React.createElement("div", {
|
|
82
82
|
className: "d-none d-md-block flex-grow-1 course-title-lockup"
|
|
83
83
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -94,7 +94,9 @@ var LearningHeader = function LearningHeader(_ref2) {
|
|
|
94
94
|
style: {
|
|
95
95
|
fontSize: '1rem'
|
|
96
96
|
}
|
|
97
|
-
}, courseTitle))),
|
|
97
|
+
}, courseTitle))), /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
className: "d-flex align-items-center"
|
|
99
|
+
}, getConfig().ENABLE_HEADER_LANG_SELECTOR && /*#__PURE__*/React.createElement("div", {
|
|
98
100
|
className: "mx-2 d-md-inline-flex"
|
|
99
101
|
}, /*#__PURE__*/React.createElement(Responsive, {
|
|
100
102
|
maxWidth: 1200
|
|
@@ -110,7 +112,7 @@ var LearningHeader = function LearningHeader(_ref2) {
|
|
|
110
112
|
authenticatedUser: authenticatedUser
|
|
111
113
|
}))), showUserDropdown && authenticatedUser && /*#__PURE__*/React.createElement(AuthenticatedUserDropdown, {
|
|
112
114
|
username: authenticatedUser.username
|
|
113
|
-
}), showUserDropdown && !authenticatedUser && /*#__PURE__*/React.createElement(AnonymousUserMenu, null)));
|
|
115
|
+
}), showUserDropdown && !authenticatedUser && /*#__PURE__*/React.createElement(AnonymousUserMenu, null))));
|
|
114
116
|
};
|
|
115
117
|
LearningHeader.propTypes = {
|
|
116
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","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 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 <LinkedLogo\n className=\"logo\"\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 <LinkedLogo\n className=\"logo\"\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\">\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 {getConfig().ENABLE_HEADER_LANG_SELECTOR && (\n
|
|
1
|
+
{"version":3,"file":"LearningHeader.js","names":["React","useContext","useEffect","useState","Responsive","PropTypes","getConfig","injectIntl","intlShape","AppContext","AnonymousUserMenu","AuthenticatedUserDropdown","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 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 <LinkedLogo\n className=\"logo\"\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 <LinkedLogo\n className=\"logo\"\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 username={authenticatedUser.username}\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,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,oBAEbtB,KAAA,CAAAuB,aAAA,MAAAC,QAAA;IAAGP,IAAI,EAAEA;EAAK,GAAKG,UAAU,gBAC3BpB,KAAA,CAAAuB,aAAA;IAAKE,SAAS,EAAC,SAAS;IAACP,GAAG,EAAEA,GAAI;IAACC,GAAG,EAAEA;EAAI,CAAE,CAC7C,CAAC;AAAA,CACL;AAEDJ,UAAU,CAACW,SAAS,GAAG;EACrBT,IAAI,EAAEZ,SAAS,CAACsB,MAAM,CAACC,UAAU;EACjCV,GAAG,EAAEb,SAAS,CAACsB,MAAM,CAACC,UAAU;EAChCT,GAAG,EAAEd,SAAS,CAACsB,MAAM,CAACC;AACxB,CAAC;AACD,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,KA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