Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add powered by logo settings #11

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/_footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
28 changes: 26 additions & 2 deletions src/components/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import parseEnvSettings from '../utils/parseData';
ensureConfig([
'LMS_BASE_URL',
'LOGO_TRADEMARK_URL',
'LOGO_POWERED_BY',
], 'Footer component');

const EVENT_NAMES = {
Expand Down Expand Up @@ -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 (
<a className="footer-powered-by" href={poweredBy.url} target="_blank" rel="noopener noreferrer">
<img
src={poweredBy.src}
alt={intl.formatMessage(messages['footer.poweredBy.altText'])}
style={{ width: '6rem' }}
/>
</a>
);
};

FooterPoweredBy.propTypes = {
intl: intlShape.isRequired,
};

class SiteFooter extends React.Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -83,8 +106,8 @@ class SiteFooter extends React.Component {
role="contentinfo"
>
<section className="footer-navigation">
<div className="container d-md-flex justify-content-between py-3 px-4">
<div className="footer-navigation__brand d-flex flex-column justify-content-between">
<div className="container d-md-flex justify-content-between py-3">
<div className="footer-navigation__brand d-flex flex-column justify-content-between px-4">
<a
className="d-block"
href={config.LMS_BASE_URL}
Expand All @@ -98,6 +121,7 @@ class SiteFooter extends React.Component {
</a>
<FooterCopyrightSection intl={intl} />
<FooterSocial intl={intl} />
<FooterPoweredBy intl={intl} />
</div>
<FooterLinks intl={intl} />

Expand Down
5 changes: 5 additions & 0 deletions src/components/Footer.messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
12 changes: 6 additions & 6 deletions src/components/__snapshots__/Footer.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ exports[`<Footer /> renders correctly renders with a language selector 1`] = `
className="footer-navigation"
>
<div
className="container d-md-flex justify-content-between py-3 px-4"
className="container d-md-flex justify-content-between py-3"
>
<div
className="footer-navigation__brand d-flex flex-column justify-content-between"
className="footer-navigation__brand d-flex flex-column justify-content-between px-4"
>
<a
aria-label="edX Home"
Expand Down Expand Up @@ -89,10 +89,10 @@ exports[`<Footer /> renders correctly renders without a language selector 1`] =
className="footer-navigation"
>
<div
className="container d-md-flex justify-content-between py-3 px-4"
className="container d-md-flex justify-content-between py-3"
>
<div
className="footer-navigation__brand d-flex flex-column justify-content-between"
className="footer-navigation__brand d-flex flex-column justify-content-between px-4"
>
<a
aria-label="edX Home"
Expand Down Expand Up @@ -131,10 +131,10 @@ exports[`<Footer /> renders correctly renders without a language selector in pt-
className="footer-navigation"
>
<div
className="container d-md-flex justify-content-between py-3 px-4"
className="container d-md-flex justify-content-between py-3"
>
<div
className="footer-navigation__brand d-flex flex-column justify-content-between"
className="footer-navigation__brand d-flex flex-column justify-content-between px-4"
>
<a
aria-label="edX Home"
Expand Down
Loading