Skip to content

Commit

Permalink
refactor: improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
asadali145 committed Feb 6, 2024
1 parent 61384a0 commit f3518f5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 20 deletions.
18 changes: 9 additions & 9 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ LOGO_URL=https://edx-cdn.org/v3/default/logo.svg
LOGO_TRADEMARK_URL=https://edx-cdn.org/v3/default/logo-trademark.svg
LOGO_WHITE_URL=https://edx-cdn.org/v3/default/logo-white.svg
FAVICON_URL=https://edx-cdn.org/v3/default/favicon.ico
ACCESSIBILITY_URL=
ABOUT_US_URL=
HONOR_CODE_URL=
CONTACT_URL=
SUPPORT_CENTER_URL=
SUPPORT_CENTER_TEXT=
TRADEMARK_TEXT=
LOGO_ALT_TEXT=
SHOW_LOGO=
ACCESSIBILITY_URL=null
ABOUT_US_URL=null
HONOR_CODE_URL=null
CONTACT_URL=null
SUPPORT_CENTER_URL=null
SUPPORT_CENTER_TEXT=null
TRADEMARK_TEXT=null
LOGO_ALT_TEXT=null
SHOW_LOGO=null
33 changes: 22 additions & 11 deletions src/components/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ import LanguageSelector from './LanguageSelector';
ensureConfig([
'LMS_BASE_URL',
'LOGO_TRADEMARK_URL',
'SHOW_LOGO',
'LOGO_ALT_TEXT',
'TRADEMARK_TEXT',
'ABOUT_US_URL',
'TERMS_OF_SERVICE_URL',
'PRIVACY_POLICY_URL',
'HONOR_CODE_URL',
'CONTACT_URL',
'ACCESSIBILITY_URL',
'SUPPORT_CENTER_URL',
'SUPPORT_CENTER_TEXT',
], 'Footer component');

const EVENT_NAMES = {
Expand Down Expand Up @@ -52,7 +63,7 @@ class SiteFooter extends React.Component {
className="footer d-flex border-top py-3 px-4"
>
<div className="container-fluid d-flex">
{ process.env.SHOW_LOGO
{ config.SHOW_LOGO
&& (
<a
className="d-block"
Expand All @@ -62,26 +73,26 @@ class SiteFooter extends React.Component {
<img
style={{ maxHeight: 45 }}
src={logo || config.LOGO_TRADEMARK_URL}
alt={process.env.LOGO_ALT_TEXT || intl.formatMessage(messages['footer.logo.altText'])}
alt={config.LOGO_ALT_TEXT || intl.formatMessage(messages['footer.logo.altText'])}
/>
</a>
)}
<div className="copyright-col">
{process.env.TRADEMARK_TEXT
{config.TRADEMARK_TEXT
&& (
<div className="text-gray-500 small">
{process.env.TRADEMARK_TEXT}
{config.TRADEMARK_TEXT}
</div>
)}
<div>
<ul className="footer-sub-nav">
{this.renderLinkIfExists(process.env.ABOUT_US_URL, 'About Us')}
{this.renderLinkIfExists(process.env.TERMS_OF_SERVICE_URL, 'Terms of Service')}
{this.renderLinkIfExists(process.env.PRIVACY_POLICY_URL, 'Privacy Policy')}
{this.renderLinkIfExists(process.env.HONOR_CODE_URL, 'Honor Code')}
{this.renderLinkIfExists(process.env.CONTACT_URL, 'Contact Us')}
{this.renderLinkIfExists(process.env.ACCESSIBILITY_URL, 'Accessibility')}
{this.renderLinkIfExists(process.env.SUPPORT_CENTER_URL, process.env.SUPPORT_CENTER_TEXT || 'FAQ & Help')}
{this.renderLinkIfExists(config.ABOUT_US_URL, 'About Us')}
{this.renderLinkIfExists(config.TERMS_OF_SERVICE_URL, 'Terms of Service')}
{this.renderLinkIfExists(config.PRIVACY_POLICY_URL, 'Privacy Policy')}
{this.renderLinkIfExists(config.HONOR_CODE_URL, 'Honor Code')}
{this.renderLinkIfExists(config.CONTACT_URL, 'Contact Us')}
{this.renderLinkIfExists(config.ACCESSIBILITY_URL, 'Accessibility')}
{this.renderLinkIfExists(config.SUPPORT_CENTER_URL, config.SUPPORT_CENTER_TEXT || 'FAQ & Help')}
</ul>
</div>
</div>
Expand Down

0 comments on commit f3518f5

Please sign in to comment.