Skip to content

Commit 6067819

Browse files
asadali145Wassaf-Shahzadarslanashraf7
committed
feat: custom footer link changes (#11)
* refactor: added configurable and consistant footer as per MITX specifications. * fix(packge.json): add MITX info * fix: updated packge name * fix: updated author name * refactor: added prepare script * fix: updated read me and removed prepare scrpt * fix: updated packages to resolve conflicts * fix: added caret ranges * fix: updated node version * docs: fix typos (#8) * refactor: update package-lock * fix: fix failing tests --------- Co-authored-by: Wassaf-Shahzad <[email protected]> Co-authored-by: Arslan Ashraf <[email protected]>
1 parent 62bf038 commit 6067819

File tree

7 files changed

+289
-27
lines changed

7 files changed

+289
-27
lines changed

.env.development

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,15 @@ LOGO_URL=https://edx-cdn.org/v3/default/logo.svg
2222
LOGO_TRADEMARK_URL=https://edx-cdn.org/v3/default/logo-trademark.svg
2323
LOGO_WHITE_URL=https://edx-cdn.org/v3/default/logo-white.svg
2424
FAVICON_URL=https://edx-cdn.org/v3/default/favicon.ico
25+
ABOUT_US_URL=
26+
PRIVACY_POLICY_URL=
27+
HONOR_CODE_URL=
28+
TERMS_OF_SERVICE_URL=
29+
CONTACT_URL=
30+
SUPPORT_CENTER_URL=
31+
SUPPORT_CENTER_TEXT=
32+
TRADEMARK_TEXT=
33+
SITE_URL=
34+
LOGO_ALT_TEXT=
35+
SHOW_LOGO=
36+
SUPPORT_EMAIL=

README.rst

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -184,16 +184,27 @@ Reporting Security Issues
184184
=========================
185185

186186
Please do not report security issues in public. Please email [email protected].
187+
=======
188+
***********
189+
Local Development
190+
***********
191+
192+
For local development and testing follow these steps. (for convenience sake consider learning MFE as parent app)
193+
194+
* Clone frontend-component-footer-mitol into frontend-app-learning directory.
195+
* CD into the frontend-component-footer-mitol and run the following commands::
196+
197+
npm i
198+
199+
npm build
200+
* Verify a `dist/` directory has been created.
201+
* CD back into frontend-app-learning and create a module.config.js file
202+
* Place the following code in the module.config.js::
203+
204+
module.exports = {
205+
localModules: [
206+
{ moduleName: '@edx/frontend-component-footer', dir: './frontend-component-footer-mitol' },
207+
}
187208

188-
.. |Build Status| image:: https://api.travis-ci.com/edx/frontend-component-footer.svg?branch=master
189-
:target: https://travis-ci.com/edx/frontend-component-footer
190-
.. |Codecov| image:: https://img.shields.io/codecov/c/github/edx/frontend-component-footer
191-
:target: @edx/frontend-component-footer
192-
.. |npm_version| image:: https://img.shields.io/npm/v/@edx/frontend-component-footer.svg
193-
:target: @edx/frontend-component-footer
194-
.. |npm_downloads| image:: https://img.shields.io/npm/dt/@edx/frontend-component-footer.svg
195-
:target: @edx/frontend-component-footer
196-
.. |license| image:: https://img.shields.io/npm/l/@edx/frontend-component-footer.svg
197-
:target: @edx/frontend-component-footer
198-
.. |semantic-release| image:: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
199-
:target: https://github.com/semantic-release/semantic-release
209+
* Restart frontend-app-learning and verify it is using the local version from @edx/frontend-component-footer
210+
* For css changes you might need to rebuild again.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "@edx/frontend-component-footer",
2+
"name": "@mitodl/frontend-component-footer-mitol",
33
"version": "1.0.0-semantically-released",
4-
"description": "Footer component for use when building Open edX frontend applications",
4+
"description": "Footer component for use when building Open edX frontend applications for MITX",
55
"main": "dist/index.js",
66
"publishConfig": {
77
"access": "public"
@@ -25,14 +25,14 @@
2525
},
2626
"repository": {
2727
"type": "git",
28-
"url": "git+https://github.com/openedx/frontend-component-footer.git"
28+
"url": "git+https://github.com/mitodl/frontend-component-footer-mitol"
2929
},
30-
"author": "edX",
30+
"author": "MIT",
3131
"license": "AGPL-3.0",
3232
"bugs": {
33-
"url": "https://github.com/openedx/frontend-component-footer/issues"
33+
"url": "https://github.com/mitodl/frontend-component-footer-mitol/issues"
3434
},
35-
"homepage": "https://github.com/openedx/frontend-component-footer#readme",
35+
"homepage": "https://github.com/mitodl/frontend-component-footer-mitol#readme",
3636
"devDependencies": {
3737
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
3838
"@edx/browserslist-config": "^1.1.1",

src/_footer.scss

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,58 @@
11
$gray-footer: #fcfcfc !default;
2+
$link-blue: #006daa;
23

34
.footer {
45
background-color: $gray-footer;
6+
7+
.copyright-col {
8+
display: flex;
9+
flex-direction: column;
10+
padding-left: 20px;
11+
padding-right: 20px;
12+
}
13+
}
14+
15+
.footer-sub-nav {
16+
padding: 0;
17+
margin: 0 0 5px;
18+
list-style: none;
19+
font-size: 15px;
20+
line-height: 20px;
21+
22+
@include media-breakpoint-down(md) {
23+
text-align: left;
24+
}
25+
26+
@include media-breakpoint-up(md) {
27+
margin: 0;
28+
}
29+
30+
li {
31+
display: inline-block;
32+
vertical-align: top;
33+
margin: 0;
34+
35+
@include media-breakpoint-down(md) {
36+
display: block;
37+
margin: 0;
38+
padding: 0 0 7px;
39+
40+
&::before {
41+
display: none;
42+
}
43+
}
44+
45+
&::before {
46+
content: "-";
47+
padding-left: 5px;
48+
padding-right: 5px;
49+
color: $link-blue
50+
}
51+
52+
&:first-child {
53+
&::before {
54+
display: none;
55+
}
56+
}
57+
}
558
}

src/components/Footer.jsx

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ class SiteFooter extends React.Component {
3333
sendTrackEvent(eventName, properties);
3434
}
3535

36+
renderLinkIfExists(value, text) {
37+
return value && <li><a href={value}>{text}</a></li>;
38+
}
39+
3640
render() {
3741
const {
3842
supportedLanguages,
@@ -42,24 +46,44 @@ class SiteFooter extends React.Component {
4246
} = this.props;
4347
const showLanguageSelector = supportedLanguages.length > 0 && onLanguageSelected;
4448
const { config } = this.context;
45-
4649
return (
4750
<footer
4851
role="contentinfo"
4952
className="footer d-flex border-top py-3 px-4"
5053
>
5154
<div className="container-fluid d-flex">
55+
{ process.env.SHOW_LOGO
56+
&& (
5257
<a
5358
className="d-block"
54-
href={config.LMS_BASE_URL}
59+
href={process.env.SITE_URL}
5560
aria-label={intl.formatMessage(messages['footer.logo.ariaLabel'])}
5661
>
5762
<img
5863
style={{ maxHeight: 45 }}
5964
src={logo || config.LOGO_TRADEMARK_URL}
60-
alt={intl.formatMessage(messages['footer.logo.altText'])}
65+
alt={process.env.LOGO_ALT_TEXT || intl.formatMessage(messages['footer.logo.altText'])}
6166
/>
6267
</a>
68+
)}
69+
<div className="copyright-col">
70+
{process.env.TRADEMARK_TEXT
71+
&& (
72+
<div className="text-gray-500 small">
73+
{process.env.TRADEMARK_TEXT}
74+
</div>
75+
)}
76+
<div>
77+
<ul className="footer-sub-nav">
78+
{this.renderLinkIfExists(process.env.ABOUT_US_URL, 'About Us')}
79+
{this.renderLinkIfExists(process.env.TERMS_OF_SERVICE_URL, 'Terms of Service')}
80+
{this.renderLinkIfExists(process.env.PRIVACY_POLICY_URL, 'Privacy Policy')}
81+
{this.renderLinkIfExists(process.env.HONOR_CODE_URL, 'Honor Code')}
82+
{this.renderLinkIfExists(process.env.Contact, 'Contact')}
83+
{this.renderLinkIfExists(process.env.SUPPORT_CENTER_URL, process.env.SUPPORT_CENTER_TEXT || 'FAQ & Help')}
84+
</ul>
85+
</div>
86+
</div>
6387
<div className="flex-grow-1" />
6488
{showLanguageSelector && (
6589
<LanguageSelector

0 commit comments

Comments
 (0)