Skip to content

NAU customized site footer component for edX frontend apps.

License

Notifications You must be signed in to change notification settings

fccn/frontend-component-footer-nau

 
 

Repository files navigation

frontend-component-footer

Build Status Codecov npm_version npm_downloads license semantic-release

Purpose

A generic footer for Open edX micro-frontend applications. It includes a logo and an optional language selector dropdown.

Getting Started

Prerequisites

The devstack is currently recommended as a development environment for your new MFE. If you start it with make dev.up.lms that should give you everything you need as a companion to this frontend.

Note that it is also possible to use Tutor to develop an MFE. You can refer to the relevant tutor-mfe documentation to get started using it.

Requirements

This component uses @edx/frontend-platform services such as i18n, analytics, configuration, and the AppContext React component, and expects that it has been loaded into a micro-frontend that has been properly initialized via @edx/frontend-platform's initialize function. Please visit the frontend template application to see an example.

Environment Variables

This component requires that the following environment variable be set by the consuming micro-frontend.

  • LMS_BASE_URL - The URL of the LMS of your Open edX instance.
  • LOGO_TRADEMARK_URL - This is a URL to a logo for use in the footer. This is a different environment variable than LOGO_URL (used in frontend-component-header) to accommodate sites that would like to have additional trademark information on a logo in the footer, such as a (tm) or (r) symbol.

Installation

To install this footer into your Open edX micro-frontend, run the following command in your MFE:

npm i --save @edx/frontend-component-footer

This will make the component available to be imported into your application.

Cloning and Startup

1. Clone your new repo:

  ``git clone https://github.com/openedx/frontend-component-footer.git``

2. Use node v18.x.

  The current version of the micro-frontend build scripts support node 18.
  Using other major versions of node *may* work, but this is unsupported.  For
  convenience, this repository includes an .nvmrc file to help in setting the
  correct node version via `nvm <https://github.com/nvm-sh/nvm>`_.

3. Install npm dependencies:

  ``cd frontend-component-footer && npm ci``

4. Start the dev server:

  ``npm start``

Usage

This library has the following exports:

  • (default): The footer as a React component.
  • messages: Internationalization messages suitable for use with @edx/frontend-platform/i18n
  • dist/footer.scss: A SASS file which contains style information for the component. It should be imported into the micro-frontend's own SCSS file.

<Footer /> component props

  • onLanguageSelected: Provides the footer with an event handler for when the user selects a language from its dropdown.
  • supportedLanguages: An array of objects representing available languages. See example below for object shape.

<AdditionalLogosSection /> component

This component is a child of the Footer component and is used to display additional logos in the footer. It uses the FOOTER_ADDITIONAL_LOGOS environment variable to determine which logos to display. If this variable is not set, the component will not render.

Configuration Example:

FOOTER_LOGOS = `[
  {"src": "https://nau-prod-richie-nau-media.rgw.nau.fccn.pt/media/filer_public_thumbnails/filer_public/db/4e/db4ed4cc-f3f0-48e1-82e6-e81f2cd042e6/modelos-barras-fundos-v04_4logos-feder_fse_nau.png__7501.0x842.0_subsampling-2.png",
  "alt": "Feder, FSE, NAU",
  "url": "https://www.fccn.pt/inovacao/projeto-nau-financiamento-sama/"},
  {"src": "https://nau-prod-richie-nau-media.rgw.nau.fccn.pt/media/filer_public_thumbnails/filer_public/e2/fd/e2fd1cfb-c520-4e3d-9cf4-273332ab4d66/incode.png__185.0x27.0_subsampling-2.png",
  "alt": "Incode",
  "url": "https://www.incode2030.gov.pt/"},
  {"src": "https://nau-prod-richie-nau-media.rgw.nau.fccn.pt/media/filer_public_thumbnails/filer_public/7d/c6/7dc6c932-e185-4dba-a659-d7e9867e150f/pt_digital_horizontal_60px.png__170.0x60.0_subsampling-2.png",
  "alt": "Portugal Digital",
  "url": "https://portugaldigital.gov.pt/"}
  ]`;

<FooterLinks /> component

The FooterLinks component is a child of the Footer component and is used to display NAU links in the footer, similar to what happens in Richie and the Legacy LMS UI. Links are provided in a list of objects, each with a title and a URL. The URL can be a string or an object containing the href to the available languages.

The file is available on src/data/footerLinks.js and it is used to provide the links to the FooterLinks component.

Configuration Example:

const links = [
{
  title: 'footer.nau.title', //section title
  menus: [
    {
      title: 'footer.nau.about', //menu item title
      url: {
        en: 'https://www.nau.edu.pt/en/about/',
        pt: 'https://www.nau.edu.pt/pt/sobre/'
      }
    },
    {
      title: 'footer.nau.courses',
      url: {
        en: 'https://www.nau.edu.pt/en/courses/',
        pt: 'https://www.nau.edu.pt/pt/cursos/'
      }
    },
    {
      title: 'footer.nau.partner',
      url: {
        en: 'https://www.nau.edu.pt/en/partners/how-to-become-a-partner/',
        pt: 'https://www.nau.edu.pt/pt/parceiros/como-se-tornar-parceiro/'
      }
    }
  ]
}];

Examples

Component Usage Example:

import Footer, { messages } from '@edx/frontend-component-footer';

...

<Footer
  onLanguageSelected={(languageCode) => {/* set language */}}
  supportedLanguages={[
    { label: 'English', value: 'en'},
    { label: 'Español', value: 'es' },
  ]}
/>

Development

Install dependencies:

npm i

Start the development server:

npm start

Build a production distribution:

npm run build

License

The code in this repository is licensed under the AGPLv3 unless otherwise noted.

Please see LICENSE for details.

Contributing

Contributions are very welcome. Please read How To Contribute for details.

This project is currently accepting all types of contributions, bug fixes, security fixes, maintenance work, or new features. However, please make sure to have a discussion about your new feature idea with the maintainers prior to beginning development to maximize the chances of your change being accepted. You can start a conversation by creating a new issue on this repo summarizing your idea.

Getting Help

If you're having trouble, we have discussion forums at https://discuss.openedx.org where you can connect with others in the community.

Our real-time conversations are on Slack. You can request a Slack invitation, then join our community Slack workspace. Because this is a frontend repository, the best place to discuss it would be in the #wg-frontend channel.

For anything non-trivial, the best path is to open an issue in this repository with as many details about the issue you are facing as you can provide.

https://github.com/openedx/frontend-component-footer/issues

For more information about these options, see the Getting Help page.

The Open edX Code of Conduct

All community members are expected to follow the Open edX Code of Conduct.

Reporting Security Issues

Please do not report security issues in public. Please email [email protected].

About

NAU customized site footer component for edX frontend apps.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 75.2%
  • SCSS 20.1%
  • Makefile 4.2%
  • HTML 0.5%