From ff9811db859bd3220b6abc2907c1cc22f75407f1 Mon Sep 17 00:00:00 2001 From: Navin Karkera Date: Tue, 4 Jul 2023 21:09:21 +0530 Subject: [PATCH] feat: configure style via config api or settings docs: update readme with MFE api customization options test: update snapshot with context feat: add option to configure link container classnames --- .env.development | 1 + README.rst | 56 ++++- src/components/Footer.jsx | 57 +++-- src/components/Footer.test.jsx | 10 + src/components/LanguageSelector.jsx | 2 +- .../__snapshots__/Footer.test.jsx.snap | 230 +++++++++++------- 6 files changed, 235 insertions(+), 121 deletions(-) diff --git a/.env.development b/.env.development index 303bf9ede2..ce12eee70f 100644 --- a/.env.development +++ b/.env.development @@ -17,3 +17,4 @@ 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 +MFE_CONFIG_API_URL=http://localhost:18000/api/mfe_config/v1 diff --git a/README.rst b/README.rst index d1a03d3dcc..334254ea27 100644 --- a/README.rst +++ b/README.rst @@ -51,22 +51,58 @@ This library has the following exports: language from its dropdown. * supportedLanguages: An array of objects representing available languages. See example below for object shape. +Customization via MFE config API +================================ + +Other than the environment variables listed above, it is also possible to customize the footer via `MFE config API `_. Below is the possible list of settings + +.. code-block:: python + + MFE_CONFIG = { + # Update footer container styling + "FOOTER_CUSTOM_STYLE": { + "backgroundImage": "url(http://)", + # to change opacity of background image + # "backgroundImage": "linear-gradient( rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.85) ) , url(http://)", + }, + # Update footer container styling via bootstrap classes + "FOOTER_CUSTOM_CLASSNAMES": "py-5 px-4 text-center flex-column justify-content-center flex-wrap text-dark", + # Update footer logo styling + "FOOTER_LOGO_STYLE": { + "marginBottom": "2rem", + }, + # Override environment variable + "LOGO_TRADEMARK_URL": "https://", + # Add links to footer + "FOOTER_LINKS": [ + {"url": "https://openedx.org/terms-of-use/", "text": "Terms of service"}, + {"url": "https://openedx.org/code-of-conduct/", "text": "Code of conduct"}, + {"url": "https://openedx.org/privacy-policy/", "text": "Privacy Policy"}, + ], + # Update link container classes + "FOOTER_LINKS_CONTAINER_CLASSNAMES": "flex-wrap", + # Update link styling + "FOOTER_LINKS_CLASSNAMES": "text-dark font-weight-bold", + } + Examples ======== -Component Usage Example:: +Component Usage Example + +.. code-block:: javascript - import Footer, { messages } from '@edx/frontend-component-footer'; + import Footer, { messages } from '@edx/frontend-component-footer'; - ... + ... -