Skip to content

Latest commit

 

History

History
244 lines (162 loc) · 9.61 KB

README.rst

File metadata and controls

244 lines (162 loc) · 9.61 KB

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.

Optionally, use the following variables to configure the Terms of Service Modal for the MFEs:

  • MODAL_UPDATE_TERMS_OF_SERVICE - Object that reppresent the text and checkbox configured for the TOS Modal
  • PRIVACY_POLICY_URL - The URL for the privacy policy.
  • TERMS_OF_SERVICE_URL - The URL for the terms of service.
  • TOS_AND_HONOR_CODE - The URL for the honor code.
  • ENABLE_FOOTER_LANG_SELECTOR - A boolean to enable the lnaguage selector in the footer component.
  • SITE_SUPPORTED_LANGUAGES - A list with all the languages to display in the selector.

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.

Terms of Service Modal

The Terms of Service Modal allows configuring a modal that prompts users to accept updated terms and conditions, including Data Authorization, Terms of Service, and/or an Honor Code.

To configure this modal, use either the MFE build-time configuration (via .env, .env.config.js) or the runtime MFE Config API to set the MODAL_UPDATE_TERMS_OF_SERVICE object. Example:

  MFE_CONFIG["MODAL_UPDATE_TERMS_OF_SERVICE"] = {
    "date_iso_8601": "2025-06-08",
    "title": {
        "en": "English modal title",
        "pt-pt": "Portuguese modal title"
    },
    "body": {
        "en": "English modal text",
        "pt-pt": "Portuguese modal text"
    },
    "data_authorization": true,
    "terms_of_service": true,
    "honor_code": true,
}

Where:

  • date_iso_8601 (required): This is a required field representing the date of the terms of service update in ISO 8601 format. It is used to track whether the user has accepted the new terms since the last update.
  • title (optional): It is an object that provides the modal title text for different languages.
  • body (optional): It is an object that provides the body content of the modal for different languages.
  • data_authorization (optional): Boolean that determines whether the Privacy Policy checkbox should be displayed in the modal.
  • terms_of_service (optional): Boolean that controls whether the Terms of Service checkbox should be shown in the modal.
  • honor_code (optional): Boolean that specifies whether the Honor Code checkbox should be displayed in the modal.

The modal conditions:

  • The modal will be displayed if the user has not yet accepted the latest terms and conditions as defined by date_iso_8601.
  • If any of the optional fields (data_authorization, terms_of_service, honor_code) are not specified, the corresponding checkboxes will not appear in the modal. The modal is multilingual, and the content for both the title and body can be customized for different locales using language keys like en (English), pt-pt (Portuguese), etc.

Plugin

The footer can be replaced using using Frontend Plugin Framework.

Information on how to utilize the FooterSlot component to do so is available in the frontend-slot-footer repository.

Examples

Component Usage Example:

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

...

<Footer />

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].