From 4e93d71120a606b33d3f5ac92e07d0dbc3faf96b Mon Sep 17 00:00:00 2001 From: Sandro Costa Date: Mon, 28 Oct 2024 17:15:07 +0000 Subject: [PATCH] feat: add powered by logo settings --- src/_footer.scss | 9 +++--- src/components/Footer.jsx | 28 +++++++++++++++++-- src/components/Footer.messages.js | 5 ++++ .../__snapshots__/Footer.test.jsx.snap | 12 ++++---- 4 files changed, 42 insertions(+), 12 deletions(-) diff --git a/src/_footer.scss b/src/_footer.scss index b3433308e..69a64a21e 100644 --- a/src/_footer.scss +++ b/src/_footer.scss @@ -6,10 +6,11 @@ $logo-color: #4e4e4e !default; } .footer-copyright { - color: $logo-color; - font-size: 0.7rem; - display: block; - line-height: 1.1; + color: $logo-color; + font-size: 0.7rem; + display: block; + line-height: 1.1; + padding: .8rem 0; } .footer-links-navigation { diff --git a/src/components/Footer.jsx b/src/components/Footer.jsx index e1722eba9..4e0f7a70c 100644 --- a/src/components/Footer.jsx +++ b/src/components/Footer.jsx @@ -14,6 +14,7 @@ import parseEnvSettings from '../utils/parseData'; ensureConfig([ 'LMS_BASE_URL', 'LOGO_TRADEMARK_URL', + 'LOGO_POWERED_BY', ], 'Footer component'); const EVENT_NAMES = { @@ -52,6 +53,28 @@ FooterCopyrightSection.propTypes = { intl: intlShape.isRequired, }; +const FooterPoweredBy = ({ intl }) => { + const POWERED_BY = getConfig().LOGO_POWERED_BY || process.env.LOGO_POWERED_BY; + + const poweredBy = parseEnvSettings(POWERED_BY); + + if (!poweredBy) { return null; } + + return ( + + {intl.formatMessage(messages['footer.poweredBy.altText'])} + + ); +}; + +FooterPoweredBy.propTypes = { + intl: intlShape.isRequired, +}; + class SiteFooter extends React.Component { constructor(props) { super(props); @@ -83,8 +106,8 @@ class SiteFooter extends React.Component { role="contentinfo" >
-
-
+
+ diff --git a/src/components/Footer.messages.js b/src/components/Footer.messages.js index b604f7ac9..77cc16cf2 100644 --- a/src/components/Footer.messages.js +++ b/src/components/Footer.messages.js @@ -121,6 +121,11 @@ const messages = defineMessages({ defaultMessage: 'Follow us on Instagram', description: 'The label for the link to the nau instagram page.', }, + 'footer.poweredBy.altText': { + id: 'footer.poweredBy.altText', + defaultMessage: 'Powered by Open edX', + description: 'The alt text for the open edx logo image.', + }, }); export default messages; diff --git a/src/components/__snapshots__/Footer.test.jsx.snap b/src/components/__snapshots__/Footer.test.jsx.snap index a6acdc54c..61e03a4df 100644 --- a/src/components/__snapshots__/Footer.test.jsx.snap +++ b/src/components/__snapshots__/Footer.test.jsx.snap @@ -8,10 +8,10 @@ exports[`