Compare commits

...

57 Commits

Author SHA1 Message Date
Brian Smith
6795147255 feat: move FooterSlot and StudioFooterSlot in from slot-footer (#521)
Co-authored-by: Muhammad Anas <88967643+Anas12091101@users.noreply.github.com>
2025-04-17 17:35:52 -04:00
Muhammad Faraz Maqsood
a87c111b3c feat: use PluginSlot to add your site logo to studio footer (#520) 2025-04-17 09:18:52 -04:00
Sarina Canelake
655d6c058b Merge pull request #517 from openedx/update-docs.edx.org-links
docs: Update references to docs.edx.org
2025-04-16 09:20:26 -04:00
Adolfo R. Brandes
923009191f Merge branch 'master' into update-docs.edx.org-links 2025-04-14 11:53:42 -03:00
Adolfo R. Brandes
80da098ec8 Merge pull request #516 from regisb/regisb/no-husky
chore: remove husky 🪓🐶
2025-04-14 11:08:42 -03:00
Adolfo R. Brandes
0197c85de5 Merge branch 'master' into regisb/no-husky 2025-04-14 11:04:08 -03:00
renovate[bot]
0ef407458c chore(deps): update dependency @openedx/frontend-build to v14.4.2 (#519)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-07 13:21:50 +00:00
renovate[bot]
c5d83f658a chore(deps): update dependency @edx/frontend-platform to v8.3.4 (#518)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-07 07:10:41 +00:00
Sarina Canelake
eb941181ea docs: Update references to docs.edx.org
With the transition to docs.openedx.org, update links to docs.edx.org to the community-supported site.
2025-04-06 10:35:39 -04:00
Régis Behmo
ed379258a8 feat: avoid pulling entire lodash library into build (#515)
Importing from lodash was causing the entire library to be pulled. This
change reduces the compressed production build size of
frontend-app-profile by 6kB.
2025-04-02 08:52:10 -04:00
Régis Behmo
8109ba39bb chore: remove husky 🪓🐶
We remove husky, which is triggering pre-push git hooks, including
running "npm lint". This is causing failures when building Docker
images, because "npm clean-install --omit=dev" automatically triggers "npm
prepare", which attemps to run "husky". But husky is not listed in the
build dependencies, only in devDependencies. As a consequence, package
installation is failing with the following error:

        14.13 > @edx/frontend-app-ora-grading@0.0.1 prepare
        14.13 > husky install
        14.13
        14.15 sh: 1: husky: not found

Similar to: https://github.com/openedx/frontend-app-learning/pull/1622
2025-04-02 12:48:48 +02:00
renovate[bot]
ebb87070da chore(deps): update dependency @openedx/frontend-build to v14.4.1 (#514)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-31 11:06:12 +00:00
renovate[bot]
cbcaf4c9fe chore(deps): update dependency @openedx/paragon to v23.4.3 (#513)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-31 05:44:12 +00:00
renovate[bot]
d3dda9e56d chore(deps): update dependency @openedx/paragon to v23.4.2 (#512)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-24 11:07:50 +00:00
renovate[bot]
db3c54201c chore(deps): update dependency @edx/frontend-platform to v8.3.3 (#511)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-24 07:03:14 +00:00
renovate[bot]
8f8b4645b4 chore(deps): update dependency react-router-dom to v6.30.0 (#510)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-17 11:45:57 +00:00
renovate[bot]
194f93e85e chore(deps): update dependency @openedx/paragon to v23.4.1 (#509)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-17 05:40:47 +00:00
Peter Kulko
10fc7a2d72 feat: add support for Paragon design tokens (#303)
---------

Co-authored-by: Diana Catalina Olarte <diana.olarte@edunext.co>
2025-03-13 10:58:01 -04:00
renovate[bot]
1d7a871cfd chore(deps): update dependency react-redux to v8.1.3 (#505)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-03 12:27:46 +00:00
renovate[bot]
cf09847e95 chore(deps): update dependency @openedx/paragon to v22.15.3 (#504)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-03 05:41:21 +00:00
Adam Stankiewicz
84e30f0fb7 feat: enable support for React 18 (#499) 2025-02-24 10:55:09 -05:00
renovate[bot]
288b6c7d0f fix(deps): update dependency ts-jest to v29.2.6 (#503)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-24 11:43:20 +00:00
renovate[bot]
9a23003f7f chore(deps): update dependency @openedx/paragon to v22.15.2 (#502)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-24 06:07:02 +00:00
renovate[bot]
922a31b90b chore(deps): update dependency @openedx/paragon to v22.15.1 (#501)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-17 05:54:05 +00:00
Adolfo R. Brandes
73236b296b Merge pull request #500 from openedx/feanil/add_owner
docs: Document the owner and drop the old metadata file
2025-02-14 16:55:10 -03:00
Feanil Patel
eb92d8f1f1 docs: Document the owner and drop the old metadata file
This is going to be changing soon with the module federation work so I
think it makes sense to be maintained by the committers-frontend group.

I'm also cleaning up the old openedx.yaml file which is obsolete and out
of date while I'm adding the new metadata that should be up-to-date.
2025-02-14 14:49:31 -05:00
renovate[bot]
bc79936022 chore(deps): update dependency @openedx/paragon to v22.14.0 (#498)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-27 08:52:28 +00:00
renovate[bot]
2aac71a988 chore(deps): update dependency @edx/browserslist-config to v1.5.0 (#497)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-27 05:27:37 +00:00
renovate[bot]
032105da7f chore(deps): update dependency react-router-dom to v6.28.2 (#496)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-20 05:06:33 +00:00
renovate[bot]
6e2ccf2f2c chore(deps): update dependency @openedx/paragon to v22.13.0 (#495)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-13 08:51:07 +00:00
renovate[bot]
907145be24 chore(deps): update dependency @edx/frontend-platform to v8.1.5 (#494)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-13 05:26:41 +00:00
renovate[bot]
58791757d7 chore(deps): update dependency @edx/frontend-platform to v8.1.4 (#492)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-06 07:47:14 +00:00
renovate[bot]
583aaf676e chore(deps): update dependency @edx/browserslist-config to v1.4.0 (#491)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-30 06:13:49 +00:00
renovate[bot]
2e46ec1f9b fix(deps): update font awesome to v6.7.2 (#490)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-23 06:15:12 +00:00
renovate[bot]
bb80d92512 chore(deps): update dependency react-router-dom to v6.28.1 (#489)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-23 05:32:44 +00:00
renovate[bot]
e138dedd29 chore(deps): update dependency @edx/frontend-platform to v8.1.3 (#488)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-16 06:41:30 +00:00
renovate[bot]
073a6c2a18 chore(deps): update dependency @openedx/frontend-build to v14.2.2 (#487)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-09 06:28:35 +00:00
renovate[bot]
41cf64b9d7 chore(deps): update dependency @openedx/frontend-plugin-framework to v1.4.1 (#485)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-02 05:14:54 +00:00
renovate[bot]
908b5b0b11 fix(deps): update font awesome to v6.7.1 (#484)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-25 11:37:33 +00:00
renovate[bot]
59dd82c919 chore(deps): update dependency @openedx/frontend-build to v14.2.0 (#483)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-25 07:08:46 +00:00
renovate[bot]
afed581a18 chore(deps): update dependency @openedx/paragon to v22.10.0 (#481)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-18 06:59:20 +00:00
renovate[bot]
f6b02cbfe7 chore(deps): update dependency react-router-dom to v6.28.0 (#480)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-11 06:47:54 +00:00
renovate[bot]
ede01dbd20 chore(deps): update dependency @openedx/frontend-plugin-framework to v1.4.0 2024-11-04 07:07:45 +00:00
Bilal Qamar
4a0f244a1a test: Remove support for Node 18 (#472) 2024-10-31 16:04:18 -04:00
renovate[bot]
906d9a78c1 chore(deps): update dependency @openedx/paragon to v22.9.0 2024-10-21 06:15:16 +00:00
renovate[bot]
ac0d5f42f7 chore(deps): update dependency react-router-dom to v6.27.0 2024-10-14 04:18:36 +00:00
renovate[bot]
e9d1b435dd chore(deps): update dependency @edx/frontend-platform to v8.1.2 2024-10-07 07:12:08 +00:00
Rômulo Penido
cc647e7bc8 feat: expose containerProps in StudioFooter [FC-0062] (#463) 2024-10-01 09:44:49 -04:00
renovate[bot]
2d5f5fe787 chore(deps): update dependency @openedx/frontend-build to v14.1.5 2024-09-30 04:09:28 +00:00
renovate[bot]
ef7bd9284a chore(deps): update dependency @openedx/frontend-build to v14.1.4 2024-09-23 04:33:25 +00:00
Bilal Qamar
10f9d7c1cd build: Upgrade to Node 20 (#471) 2024-09-19 17:50:12 -04:00
Bilal Qamar
6b3a49ccec test: Add Node 20 to CI matrix (#467) 2024-09-16 11:41:53 -04:00
renovate[bot]
f473c98bb8 chore(deps): update dependency @openedx/paragon to v22.8.1 2024-09-16 11:27:58 +00:00
renovate[bot]
bd52be3177 chore(deps): update dependency react-router-dom to v6.26.2 2024-09-16 07:18:57 +00:00
renovate[bot]
ef12ac20fe chore(deps): update dependency @openedx/frontend-plugin-framework to v1.3.0 2024-09-09 07:44:24 +00:00
renovate[bot]
7fa6bd8740 chore(deps): update dependency @openedx/frontend-build to v14.1.2 2024-09-09 05:03:32 +00:00
renovate[bot]
8d9178f532 chore(deps): update dependency @openedx/frontend-build to v14.1.1 2024-09-02 07:37:30 +00:00
28 changed files with 9726 additions and 7968 deletions

View File

@@ -14,12 +14,10 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Nodejs Env
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VER }}
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm ci
- name: Validate package-lock.json changes

View File

@@ -10,4 +10,4 @@ on:
jobs:
version-check:
uses: openedx/.github/.github/workflows/lockfile-check.yml@master
uses: openedx/.github/.github/workflows/lockfileversion-check-v3.yml@master

2
.gitignore vendored
View File

@@ -10,4 +10,4 @@ src/i18n/transifex_input.json
temp/babel-plugin-react-intl
/.vscode
module.config.js
src/i18n/messages
src/i18n/messages

2
.nvmrc
View File

@@ -1 +1 @@
18
20

View File

@@ -95,9 +95,9 @@ This library has the following exports:
Plugin
======
The footer can be replaced using using `Frontend Plugin Framework <https://github.com/openedx/frontend-plugin-framework>`_.
The footer can be replaced or modified using `Frontend Plugin Framework <https://github.com/openedx/frontend-plugin-framework>`_.
Information on how to utilize the ``FooterSlot`` component to do so is available in the `frontend-slot-footer repository <https://github.com/openedx/frontend-slot-footer/>`_.
Information on how to replace or modify the footer is available `here </src/plugin-slots>`_.
Examples
========

14
catalog-info.yaml Normal file
View File

@@ -0,0 +1,14 @@
# This file records information about this repo. Its use is described in OEP-55:
# https://open-edx-proposals.readthedocs.io/en/latest/processes/oep-0055-proc-project-maintainers.html
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: "frontend-component-footer"
description: "A generic footer for the Open edX micro-frontend applications."
annotations:
openedx.org/arch-interest-groups: ""
spec:
owner: group:committers-frontend
type: "library"
lifecycle: "production"

View File

@@ -1,6 +1,4 @@
@import "@edx/brand/paragon/fonts";
@import "@edx/brand/paragon/variables";
@import "@openedx/paragon/scss/core/core";
@import "@edx/brand/paragon/overrides";
@use "@openedx/paragon/dist/core.min.css" as paragonCore;
@use "@openedx/paragon/dist/light.min.css" as paragonLight;
@import "@edx/frontend-component-footer/footer";

View File

@@ -1,8 +0,0 @@
# openedx.yaml
---
owner: edx/fedx-team
tags:
- library
- component
- react

17292
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -10,19 +10,16 @@
"build": "make build",
"i18n_extract": "fedx-scripts formatjs extract",
"lint": "fedx-scripts eslint --ext .js --ext .jsx .",
"lint:fix": "fedx-scripts eslint --fix --ext .js --ext .jsx .",
"snapshot": "fedx-scripts jest --updateSnapshot",
"start": "fedx-scripts webpack-dev-server --progress",
"start:with-theme": "paragon install-theme && npm start && npm install",
"test": "fedx-scripts jest --coverage"
"test": "fedx-scripts jest --coverage",
"test:watch": "npm run test -- --watch"
},
"files": [
"/dist"
],
"husky": {
"hooks": {
"pre-commit": "npm run lint"
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/openedx/frontend-component-footer.git"
@@ -36,38 +33,40 @@
"devDependencies": {
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
"@edx/browserslist-config": "^1.1.1",
"@edx/frontend-platform": "8.1.1",
"@edx/frontend-platform": "^8.2.1",
"@edx/reactifex": "^2.1.1",
"@openedx/frontend-build": "14.1.0",
"@openedx/frontend-plugin-framework": "^1.1.2",
"@openedx/paragon": "22.7.0",
"@openedx/frontend-build": "^14.3.1",
"@openedx/paragon": "^23.3.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^12.1.1",
"husky": "8.0.3",
"@testing-library/react": "^16.2.0",
"@testing-library/dom": "^10.4.0",
"@testing-library/user-event": "^14.6.1",
"prop-types": "15.8.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-redux": "7.2.9",
"react-router-dom": "6.26.1",
"react-test-renderer": "17.0.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-redux": "8.1.3",
"react-router-dom": "6.30.0",
"react-test-renderer": "18.3.1",
"redux": "4.2.1",
"semantic-release": "21.1.2"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "6.6.0",
"@fortawesome/free-brands-svg-icons": "6.6.0",
"@fortawesome/free-regular-svg-icons": "6.6.0",
"@fortawesome/free-solid-svg-icons": "6.6.0",
"@fortawesome/fontawesome-svg-core": "6.7.2",
"@fortawesome/free-brands-svg-icons": "6.7.2",
"@fortawesome/free-regular-svg-icons": "6.7.2",
"@fortawesome/free-solid-svg-icons": "6.7.2",
"@fortawesome/react-fontawesome": "0.2.2",
"@openedx/frontend-plugin-framework": "^1.7.0",
"classnames": "^2.5.1",
"jest-environment-jsdom": "^29.7.0",
"lodash": "^4.17.21",
"ts-jest": "^29.1.2"
},
"peerDependencies": {
"@edx/frontend-platform": "^7.0.0 || ^8.0.0",
"@openedx/paragon": ">= 21.11.3 < 23.0.0",
"@openedx/paragon": ">= 21.11.3 < 24.0.0",
"prop-types": "^15.5.10",
"react": "^16.9.0 || ^17.0.0",
"react-dom": "^16.9.0 || ^17.0.0"
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0"
}
}

View File

@@ -1,5 +1,5 @@
$gray-footer: #fcfcfc !default;
.footer {
background-color: $gray-footer;
background-color: var(--pgn-color-light-100, $gray-footer);
}

View File

@@ -1,11 +1,13 @@
/* eslint-disable react/prop-types */
import React, { useMemo } from 'react';
import renderer from 'react-test-renderer';
import { render, fireEvent, screen } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { IntlProvider } from '@edx/frontend-platform/i18n';
import { AppContext } from '@edx/frontend-platform/react';
import Footer from './Footer';
import FooterSlot from '../plugin-slots/FooterSlot';
const FooterWithContext = ({ locale = 'es' }) => {
const contextValue = useMemo(() => ({
@@ -21,7 +23,7 @@ const FooterWithContext = ({ locale = 'es' }) => {
<AppContext.Provider
value={contextValue}
>
<Footer />
<FooterSlot />
</AppContext.Provider>
</IntlProvider>
);
@@ -76,19 +78,13 @@ describe('<Footer />', () => {
});
describe('handles language switching', () => {
it('calls onLanguageSelected prop when a language is changed', () => {
it('calls onLanguageSelected prop when a language is changed', async () => {
const user = userEvent.setup();
const mockHandleLanguageSelected = jest.fn();
render(<FooterWithLanguageSelector languageSelected={mockHandleLanguageSelected} />);
fireEvent.submit(screen.getByTestId('site-footer-submit-btn'), {
target: {
elements: {
'site-footer-language-select': {
value: 'es',
},
},
},
});
await user.selectOptions(screen.getByRole('combobox'), 'es');
await user.click(screen.getByTestId('site-footer-submit-btn'));
expect(mockHandleLanguageSelected).toHaveBeenCalledWith('es');
});

View File

@@ -1,6 +1,6 @@
import React, { useContext, useState } from 'react';
import _ from 'lodash';
import { intlShape, injectIntl, FormattedMessage } from '@edx/frontend-platform/i18n';
import isEmpty from 'lodash/isEmpty';
import { useIntl, FormattedMessage } from '@edx/frontend-platform/i18n';
import { ensureConfig } from '@edx/frontend-platform';
import { AppContext } from '@edx/frontend-platform/react';
import {
@@ -8,11 +8,14 @@ import {
Button,
Container,
Hyperlink,
Image,
TransitionReplace,
} from '@openedx/paragon';
import { ExpandLess, ExpandMore, Help } from '@openedx/paragon/icons';
import classNames from 'classnames';
import PropTypes from 'prop-types';
import messages from './messages';
import StudioFooterLogoSlot from '../../plugin-slots/StudioFooterLogoSlot';
ensureConfig([
'LMS_BASE_URL',
@@ -26,12 +29,14 @@ ensureConfig([
], 'Studio Footer component');
const StudioFooter = ({
// injected
intl,
containerProps,
}) => {
const intl = useIntl();
const [isOpen, setIsOpen] = useState(false);
const { config } = useContext(AppContext);
const { containerClassName, ...restContainerProps } = containerProps || {};
return (
<>
<div className="m-0 mt-6 row align-items-center justify-content-center">
@@ -49,17 +54,21 @@ const StudioFooter = ({
</Button>
<div className="col border-top ml-2" />
</div>
<Container size="xl" className="px-4">
<Container
size="xl"
className={classNames('px-4', containerClassName)}
{...restContainerProps}
>
<TransitionReplace>
{isOpen ? (
<ActionRow key="help-link-button-row" className="py-4" data-testid="helpButtonRow">
<ActionRow.Spacer />
<Button as="a" href="https://docs.edx.org/" size="sm">
<Button as="a" href="https://docs.openedx.org/" size="sm">
<FormattedMessage {...messages.edxDocumentationButtonLabel} />
</Button>
<Button
as="a"
href="https://open.edx.org/"
href="https://openedx.org/"
size="sm"
data-testid="openEdXPortalButton"
>
@@ -79,7 +88,7 @@ const StudioFooter = ({
>
<FormattedMessage {...messages.studioXButtonLabel} />
</Button>
{!_.isEmpty(config.SUPPORT_EMAIL) && (
{!isEmpty(config.SUPPORT_EMAIL) && (
<Button
as="a"
href={`mailto:${config.SUPPORT_EMAIL}`}
@@ -96,11 +105,11 @@ const StudioFooter = ({
<ActionRow className="pt-3 m-0 x-small">
© {new Date().getFullYear()} <Hyperlink destination={config.MARKETING_SITE_BASE_URL} target="_blank" className="ml-2">{config.SITE_NAME}</Hyperlink>
<ActionRow.Spacer />
{!_.isEmpty(config.TERMS_OF_SERVICE_URL) && (
{!isEmpty(config.TERMS_OF_SERVICE_URL) && (
<Hyperlink destination={config.TERMS_OF_SERVICE_URL} data-testid="termsOfService">
{intl.formatMessage(messages.termsOfServiceLinkLabel)}
</Hyperlink>
)}{!_.isEmpty(config.PRIVACY_POLICY_URL) && (
)}{!isEmpty(config.PRIVACY_POLICY_URL) && (
<Hyperlink destination={config.PRIVACY_POLICY_URL} data-testid="privacyPolicy">
{intl.formatMessage(messages.privacyPolicyLinkLabel)}
</Hyperlink>
@@ -125,13 +134,7 @@ const StudioFooter = ({
<FormattedMessage {...messages.trademarkMessage} />
<Hyperlink className="ml-1" destination="https://www.edx.org">edX Inc</Hyperlink>.
<ActionRow.Spacer />
<Hyperlink destination="https://open.edx.org" className="float-right">
<Image
width="120px"
alt="Powered by Open edX"
src="https://logos.openedx.org/open-edx-logo-tag.png"
/>
</Hyperlink>
<StudioFooterLogoSlot />
</ActionRow>
</Container>
</>
@@ -139,8 +142,11 @@ const StudioFooter = ({
};
StudioFooter.propTypes = {
// injected
intl: intlShape.isRequired,
containerProps: PropTypes.shape(Container.propTypes),
};
export default injectIntl(StudioFooter);
StudioFooter.defaultProps = {
containerProps: {},
};
export default StudioFooter;

View File

@@ -1,10 +1,11 @@
/* eslint-disable react/prop-types */
import React, { useMemo } from 'react';
import { fireEvent, render, screen } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import '@testing-library/jest-dom/extend-expect';
import { IntlProvider } from '@edx/frontend-platform/i18n';
import { AppContext } from '@edx/frontend-platform/react';
import StudioFooter from './StudioFooter';
import StudioFooterSlot from '../../plugin-slots/StudioFooterSlot';
import messages from './messages';
const config = {
@@ -35,7 +36,7 @@ const Component = ({ updateVariable }) => {
return (
<IntlProvider locale="en">
<AppContext.Provider value={contextValue}>
<StudioFooter />
<StudioFooterSlot />
</AppContext.Provider>
</IntlProvider>
);
@@ -56,35 +57,40 @@ describe('Footer', () => {
});
});
describe('help section expanded view', () => {
it('help button should read Hide Studio help', () => {
it('help button should read Hide Studio help', async () => {
const user = userEvent.setup();
render(<Component />);
const helpToggleButton = screen.getByText(messages.openHelpButtonLabel.defaultMessage);
fireEvent.click(helpToggleButton);
await user.click(helpToggleButton);
expect(screen.getByText(messages.closeHelpButtonLabel.defaultMessage))
.toBeVisible();
});
it('help button link row should be visible', () => {
it('help button link row should be visible', async () => {
const user = userEvent.setup();
render(<Component />);
const helpToggleButton = screen.getByText(messages.openHelpButtonLabel.defaultMessage);
fireEvent.click(helpToggleButton);
await user.click(helpToggleButton);
expect(screen.getByTestId('helpButtonRow')).toBeVisible();
});
it('Open edX portal button should be visible', () => {
it('Open edX portal button should be visible', async () => {
const user = userEvent.setup();
render(<Component />);
const helpToggleButton = screen.getByText(messages.openHelpButtonLabel.defaultMessage);
fireEvent.click(helpToggleButton);
await user.click(helpToggleButton);
expect(screen.getByTestId('openEdXPortalButton')).toBeVisible();
});
it('should not show contact us button', () => {
it('should not show contact us button', async () => {
const user = userEvent.setup();
render(<Component />);
const helpToggleButton = screen.getByText(messages.openHelpButtonLabel.defaultMessage);
fireEvent.click(helpToggleButton);
await user.click(helpToggleButton);
expect(screen.queryByTestId('contactUsButton')).toBeNull();
});
it('should show contact us button', () => {
it('should show contact us button', async () => {
const user = userEvent.setup();
render(<Component updateVariable={['SUPPORT_EMAIL', 'support@email.com']} />);
const helpToggleButton = screen.getByText(messages.openHelpButtonLabel.defaultMessage);
fireEvent.click(helpToggleButton);
await user.click(helpToggleButton);
expect(screen.getByTestId('contactUsButton')).toBeVisible();
});
});

View File

@@ -1,8 +1,10 @@
import Footer, { EVENT_NAMES } from './components/Footer';
import messages from './i18n/index';
import StudioFooter from './components/studio-footer';
import FooterSlot from './plugin-slots/FooterSlot';
import StudioFooterSlot from './plugin-slots/StudioFooterSlot';
export default Footer;
export {
messages, EVENT_NAMES, StudioFooter,
messages, EVENT_NAMES, StudioFooter, FooterSlot, StudioFooterSlot,
};

View File

@@ -0,0 +1,51 @@
# FooterSlot
### Slot ID: `org.openedx.frontend.layout.footer.v1`
### Slot ID Aliases
* `footer_slot`
## Description
This slot is used to repace/modify/hide the entire footer.
## Example
The following `env.config.jsx` will replace the default footer.
![Screenshot of default footer](./images/default_footer.png)
with a simple custom footer
![Screenshot of custom footer](./images/custom_footer.png)
```jsx
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
const config = {
pluginSlots: {
'org.openedx.frontend.layout.footer.v1': {
plugins: [
{
// Hide the default footer
op: PLUGIN_OPERATIONS.Hide,
widgetId: 'default_contents',
},
{
// Insert a custom footer
op: PLUGIN_OPERATIONS.Insert,
widget: {
id: 'custom_footer',
type: DIRECT_PLUGIN,
RenderWidget: () => (
<h1 style={{textAlign: 'center'}}>🦶</h1>
),
},
},
]
}
},
}
export default config;
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@@ -0,0 +1,11 @@
import React from 'react';
import { PluginSlot } from '@openedx/frontend-plugin-framework';
import Footer from '../../components/Footer';
const FooterSlot = () => (
<PluginSlot id="org.openedx.frontend.layout.footer.v1" idAliases={['footer_slot']}>
<Footer />
</PluginSlot>
);
export default FooterSlot;

View File

@@ -0,0 +1,5 @@
# `frontend-component-footer` Plugin Slots
* [`org.openedx.frontend.layout.footer.v1`](./FooterSlot/)
* [`org.openedx.frontend.layout.studio_footer.v1`](./StudioFooterSlot/)
* [`org.openedx.frontend.layout.studio_footer_logo.v1`](./StudioFooterLogoSlot/)

View File

@@ -0,0 +1,57 @@
# StudioFooterLogoSlot
### Slot ID: `org.openedx.frontend.layout.studio_footer_logo.v1`
### Slot ID Aliases
* `studio_footer_logo_slot`
## Description
This slot is used to add your site logo to the studio footer.
## Examples
### Add your site logo.
The following `env.config.jsx` will add your site logo to the studio footer.
![Screenshot of modified Studio Footer Logo](./images/add_your_site_logo.png)
```jsx
import { PLUGIN_OPERATIONS, DIRECT_PLUGIN } from '@openedx/frontend-plugin-framework';
import {
Hyperlink,
Image,
} from '@openedx/paragon';
const config = {
pluginSlots: {
'org.openedx.frontend.layout.studio_footer_logo.v1': {
keepDefault: true,
plugins: [
{
op: PLUGIN_OPERATIONS.Insert,
widget: {
id: 'studio_footer_logo_addition',
type: DIRECT_PLUGIN,
priority: 40,
RenderWidget: () => {
return (
<Hyperlink destination="https://example.com/" className="float-right">
<Image
height="48px"
alt="Hosted by MySite"
src="https://logos.openedx.org/generic-logo.svg"
/>
</Hyperlink>
)
}
}
},
],
}
},
};
export default config;
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 KiB

View File

@@ -0,0 +1,17 @@
import React from 'react';
import { PluginSlot } from '@openedx/frontend-plugin-framework';
import { Hyperlink, Image } from '@openedx/paragon';
const StudioFooterLogoSlot = () => (
<PluginSlot id="org.openedx.frontend.layout.studio_footer_logo.v1" idAliases={['studio_footer_logo_slot']}>
<Hyperlink destination="https://openedx.org" className="float-right">
<Image
width="120px"
alt="Powered by Open edX"
src="https://logos.openedx.org/open-edx-logo-tag.png"
/>
</Hyperlink>
</PluginSlot>
);
export default StudioFooterLogoSlot;

View File

@@ -0,0 +1,51 @@
# StudioFooterSlot
### Slot ID: `org.openedx.frontend.layout.studio_footer.v1`
### Slot ID Aliases
* `studio_footer_slot`
## Description
This slot is used to repace/modify/hide the entire studio footer.
## Example
The following `env.config.jsx` will replace the default studio footer.
![Screenshot of default studio footer](./images/default_studio_footer.png)
with a simple custom footer
![Screenshot of custom footer](./images/custom_footer.png)
```jsx
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
const config = {
pluginSlots: {
'org.openedx.frontend.layout.studio_footer.v1': {
plugins: [
{
// Hide the default footer
op: PLUGIN_OPERATIONS.Hide,
widgetId: 'default_contents',
},
{
// Insert a custom footer
op: PLUGIN_OPERATIONS.Insert,
widget: {
id: 'custom_footer',
type: DIRECT_PLUGIN,
RenderWidget: () => (
<h1 style={{textAlign: 'center'}}>🦶</h1>
),
},
},
]
}
},
}
export default config;
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

View File

@@ -0,0 +1,11 @@
import React from 'react';
import { PluginSlot } from '@openedx/frontend-plugin-framework';
import StudioFooter from '../../components/studio-footer';
const StudioFooterSlot = () => (
<PluginSlot id="org.openedx.frontend.layout.studio_footer.v1" idAliases={['studio_footer_slot']}>
<StudioFooter />
</PluginSlot>
);
export default StudioFooterSlot;

View File

@@ -2,7 +2,9 @@ const path = require('path');
const { createConfig } = require('@openedx/frontend-build');
module.exports = createConfig('webpack-dev', {
entry: path.resolve(__dirname, 'example'),
entry: {
app: path.resolve(__dirname, 'example'),
},
output: {
path: path.resolve(__dirname, 'example/dist'),
publicPath: '/',