Compare commits
110 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a9e3f8fba | ||
|
|
b2c55a09e5 | ||
|
|
6795147255 | ||
|
|
a87c111b3c | ||
|
|
655d6c058b | ||
|
|
923009191f | ||
|
|
80da098ec8 | ||
|
|
0197c85de5 | ||
|
|
0ef407458c | ||
|
|
c5d83f658a | ||
|
|
eb941181ea | ||
|
|
ed379258a8 | ||
|
|
8109ba39bb | ||
|
|
ebb87070da | ||
|
|
cbcaf4c9fe | ||
|
|
d3dda9e56d | ||
|
|
db3c54201c | ||
|
|
8f8b4645b4 | ||
|
|
194f93e85e | ||
|
|
10fc7a2d72 | ||
|
|
1d7a871cfd | ||
|
|
cf09847e95 | ||
|
|
84e30f0fb7 | ||
|
|
288b6c7d0f | ||
|
|
9a23003f7f | ||
|
|
922a31b90b | ||
|
|
73236b296b | ||
|
|
eb92d8f1f1 | ||
|
|
bc79936022 | ||
|
|
2aac71a988 | ||
|
|
032105da7f | ||
|
|
6e2ccf2f2c | ||
|
|
907145be24 | ||
|
|
58791757d7 | ||
|
|
583aaf676e | ||
|
|
2e46ec1f9b | ||
|
|
bb80d92512 | ||
|
|
e138dedd29 | ||
|
|
073a6c2a18 | ||
|
|
41cf64b9d7 | ||
|
|
908b5b0b11 | ||
|
|
59dd82c919 | ||
|
|
afed581a18 | ||
|
|
f6b02cbfe7 | ||
|
|
ede01dbd20 | ||
|
|
4a0f244a1a | ||
|
|
906d9a78c1 | ||
|
|
ac0d5f42f7 | ||
|
|
e9d1b435dd | ||
|
|
cc647e7bc8 | ||
|
|
2d5f5fe787 | ||
|
|
ef7bd9284a | ||
|
|
10f9d7c1cd | ||
|
|
6b3a49ccec | ||
|
|
f473c98bb8 | ||
|
|
bd52be3177 | ||
|
|
ef12ac20fe | ||
|
|
7fa6bd8740 | ||
|
|
8d9178f532 | ||
|
|
98bcacfced | ||
|
|
ac78454133 | ||
|
|
09b7c8be9a | ||
|
|
c992a9129a | ||
|
|
7f6ad73a25 | ||
|
|
cefbd28d9b | ||
|
|
c26bdc54e1 | ||
|
|
02f6b44368 | ||
|
|
4cbde7e38f | ||
|
|
bdb6ecb79f | ||
|
|
46c1ffd731 | ||
|
|
b6bd211c6e | ||
|
|
ef8445a1b2 | ||
|
|
5b34595520 | ||
|
|
32ae2d8e7c | ||
|
|
abac1cd6d4 | ||
|
|
e0115e3d88 | ||
|
|
ff18f3add9 | ||
|
|
4926c3105b | ||
|
|
838a81a020 | ||
|
|
0ac6840cea | ||
|
|
26a17bf2e4 | ||
|
|
17b9710810 | ||
|
|
df0129485e | ||
|
|
1c2f290faa | ||
|
|
9af9024bcc | ||
|
|
0008bd485a | ||
|
|
181b9916a0 | ||
|
|
22dbec317c | ||
|
|
6f15e4dafa | ||
|
|
9f5aed3c76 | ||
|
|
54bc04b182 | ||
|
|
ea2578fa15 | ||
|
|
5f7fab236d | ||
|
|
adf5f6c9a8 | ||
|
|
132b080195 | ||
|
|
0d4ea96874 | ||
|
|
8b9f5fa348 | ||
|
|
c014e30ca8 | ||
|
|
0e6ab3c358 | ||
|
|
7d0a126580 | ||
|
|
c422ce40be | ||
|
|
7299d5367f | ||
|
|
38203b91ba | ||
|
|
83c340fe08 | ||
|
|
9eaebf4b11 | ||
|
|
2a883857cf | ||
|
|
5f26c1ae93 | ||
|
|
89ad7234ac | ||
|
|
936915f81f | ||
|
|
b993992987 |
9
.github/workflows/ci.yml
vendored
9
.github/workflows/ci.yml
vendored
@@ -14,12 +14,10 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Setup Nodejs Env
|
|
||||||
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV
|
|
||||||
- name: Setup Nodejs
|
- name: Setup Nodejs
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VER }}
|
node-version-file: '.nvmrc'
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: Validate package-lock.json changes
|
- name: Validate package-lock.json changes
|
||||||
@@ -33,4 +31,7 @@ jobs:
|
|||||||
- name: i18n_extract
|
- name: i18n_extract
|
||||||
run: npm run i18n_extract
|
run: npm run i18n_extract
|
||||||
- name: Coverage
|
- name: Coverage
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
fail_ci_if_error: true
|
||||||
|
|||||||
2
.github/workflows/lockfileversion-check.yml
vendored
2
.github/workflows/lockfileversion-check.yml
vendored
@@ -10,4 +10,4 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
version-check:
|
version-check:
|
||||||
uses: openedx/.github/.github/workflows/lockfile-check.yml@master
|
uses: openedx/.github/.github/workflows/lockfileversion-check-v3.yml@master
|
||||||
|
|||||||
5
.github/workflows/release.yml
vendored
5
.github/workflows/release.yml
vendored
@@ -30,7 +30,10 @@ jobs:
|
|||||||
- name: i18n_extract
|
- name: i18n_extract
|
||||||
run: npm run i18n_extract
|
run: npm run i18n_extract
|
||||||
- name: Coverage
|
- name: Coverage
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
fail_ci_if_error: false
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build
|
run: npm run build
|
||||||
- name: Release
|
- name: Release
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,3 +10,4 @@ src/i18n/transifex_input.json
|
|||||||
temp/babel-plugin-react-intl
|
temp/babel-plugin-react-intl
|
||||||
/.vscode
|
/.vscode
|
||||||
module.config.js
|
module.config.js
|
||||||
|
src/i18n/messages
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
[main]
|
|
||||||
host = https://www.transifex.com
|
|
||||||
|
|
||||||
[o:open-edx:p:edx-platform:r:frontend-component-footer]
|
|
||||||
file_filter = src/i18n/messages/<lang>.json
|
|
||||||
source_file = src/i18n/transifex_input.json
|
|
||||||
source_lang = en
|
|
||||||
type = KEYVALUEJSON
|
|
||||||
|
|
||||||
17
Makefile
17
Makefile
@@ -1,6 +1,3 @@
|
|||||||
export TRANSIFEX_RESOURCE = frontend-component-footer
|
|
||||||
transifex_langs = "ar,fr,es_419,zh_CN,pt,it,de,uk,ru,hi,fr_CA,it_IT,pt_PT,de_DE"
|
|
||||||
|
|
||||||
transifex_utils = ./node_modules/.bin/transifex-utils.js
|
transifex_utils = ./node_modules/.bin/transifex-utils.js
|
||||||
i18n = ./src/i18n
|
i18n = ./src/i18n
|
||||||
transifex_input = $(i18n)/transifex_input.json
|
transifex_input = $(i18n)/transifex_input.json
|
||||||
@@ -35,20 +32,6 @@ detect_changed_source_translations:
|
|||||||
# Checking for changed translations...
|
# Checking for changed translations...
|
||||||
git diff --exit-code $(i18n)
|
git diff --exit-code $(i18n)
|
||||||
|
|
||||||
# Pushes translations to Transifex. You must run make extract_translations first.
|
|
||||||
push_translations:
|
|
||||||
# Pushing strings to Transifex...
|
|
||||||
tx push -s
|
|
||||||
# Fetching hashes from Transifex...
|
|
||||||
./node_modules/@edx/reactifex/bash_scripts/get_hashed_strings_v3.sh
|
|
||||||
# Writing out comments to file...
|
|
||||||
$(transifex_utils) $(transifex_temp) --comments --v3-scripts-path
|
|
||||||
# Pushing comments to Transifex...
|
|
||||||
./node_modules/@edx/reactifex/bash_scripts/put_comments_v3.sh
|
|
||||||
|
|
||||||
# Pulls translations from Transifex.
|
|
||||||
pull_translations:
|
|
||||||
tx pull -t -f --mode reviewed --languages=$(transifex_langs)
|
|
||||||
|
|
||||||
# This target is used by Travis.
|
# This target is used by Travis.
|
||||||
validate-no-uncommitted-package-lock-changes:
|
validate-no-uncommitted-package-lock-changes:
|
||||||
|
|||||||
@@ -93,6 +93,12 @@ This library has the following exports:
|
|||||||
language from its dropdown.
|
language from its dropdown.
|
||||||
* supportedLanguages: An array of objects representing available languages. See example below for object shape.
|
* supportedLanguages: An array of objects representing available languages. See example below for object shape.
|
||||||
|
|
||||||
|
Plugin
|
||||||
|
======
|
||||||
|
The footer can be replaced or modified using `Frontend Plugin Framework <https://github.com/openedx/frontend-plugin-framework>`_.
|
||||||
|
|
||||||
|
Information on how to replace or modify the footer is available `here </src/plugin-slots>`_.
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
========
|
========
|
||||||
|
|
||||||
@@ -113,6 +119,8 @@ Component Usage Example::
|
|||||||
* `An example of minimal component and messages usage. <https://github.com/openedx/frontend-template-application/blob/3355bb3a96232390e9056f35b06ffa8f105ed7ca/src/index.jsx#L23>`_
|
* `An example of minimal component and messages usage. <https://github.com/openedx/frontend-template-application/blob/3355bb3a96232390e9056f35b06ffa8f105ed7ca/src/index.jsx#L23>`_
|
||||||
* `An example of SCSS file usage. <https://github.com/openedx/frontend-template-application/blob/3cd5485bf387b8c479baf6b02bf59e3061dc3465/src/index.scss#L9>`_
|
* `An example of SCSS file usage. <https://github.com/openedx/frontend-template-application/blob/3cd5485bf387b8c479baf6b02bf59e3061dc3465/src/index.scss#L9>`_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Development
|
Development
|
||||||
===========
|
===========
|
||||||
|
|
||||||
|
|||||||
14
catalog-info.yaml
Normal file
14
catalog-info.yaml
Normal 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"
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
@import "@edx/brand/paragon/fonts";
|
@use "@openedx/paragon/dist/core.min.css" as paragonCore;
|
||||||
@import "@edx/brand/paragon/variables";
|
@use "@openedx/paragon/dist/light.min.css" as paragonLight;
|
||||||
@import "@openedx/paragon/scss/core/core";
|
|
||||||
@import "@edx/brand/paragon/overrides";
|
|
||||||
|
|
||||||
@import "@edx/frontend-component-footer/footer";
|
@import "@edx/frontend-component-footer/footer";
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
# openedx.yaml
|
|
||||||
|
|
||||||
---
|
|
||||||
owner: edx/fedx-team
|
|
||||||
tags:
|
|
||||||
- library
|
|
||||||
- component
|
|
||||||
- react
|
|
||||||
27555
package-lock.json
generated
27555
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
54
package.json
54
package.json
@@ -10,19 +10,16 @@
|
|||||||
"build": "make build",
|
"build": "make build",
|
||||||
"i18n_extract": "fedx-scripts formatjs extract",
|
"i18n_extract": "fedx-scripts formatjs extract",
|
||||||
"lint": "fedx-scripts eslint --ext .js --ext .jsx .",
|
"lint": "fedx-scripts eslint --ext .js --ext .jsx .",
|
||||||
|
"lint:fix": "fedx-scripts eslint --fix --ext .js --ext .jsx .",
|
||||||
"snapshot": "fedx-scripts jest --updateSnapshot",
|
"snapshot": "fedx-scripts jest --updateSnapshot",
|
||||||
"start": "fedx-scripts webpack-dev-server --progress",
|
"start": "fedx-scripts webpack-dev-server --progress",
|
||||||
"start:with-theme": "paragon install-theme && npm start && npm install",
|
"start:with-theme": "paragon install-theme && npm start && npm install",
|
||||||
"test": "fedx-scripts jest"
|
"test": "fedx-scripts jest --coverage",
|
||||||
|
"test:watch": "npm run test -- --watch"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"/dist"
|
"/dist"
|
||||||
],
|
],
|
||||||
"husky": {
|
|
||||||
"hooks": {
|
|
||||||
"pre-commit": "npm run lint"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/openedx/frontend-component-footer.git"
|
"url": "git+https://github.com/openedx/frontend-component-footer.git"
|
||||||
@@ -36,35 +33,40 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
|
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
|
||||||
"@edx/browserslist-config": "^1.1.1",
|
"@edx/browserslist-config": "^1.1.1",
|
||||||
"@openedx/frontend-build": "^13.0.19",
|
"@edx/frontend-platform": "^8.2.1",
|
||||||
"@openedx/paragon": "22.0.0",
|
|
||||||
"@edx/frontend-platform": "6.2.0",
|
|
||||||
"@edx/reactifex": "^2.1.1",
|
"@edx/reactifex": "^2.1.1",
|
||||||
|
"@openedx/frontend-build": "^14.3.1",
|
||||||
|
"@openedx/paragon": "^23.3.0",
|
||||||
"@testing-library/jest-dom": "^5.16.4",
|
"@testing-library/jest-dom": "^5.16.4",
|
||||||
"@testing-library/react": "^12.1.1",
|
"@testing-library/react": "^16.2.0",
|
||||||
"husky": "8.0.3",
|
"@testing-library/dom": "^10.4.0",
|
||||||
|
"@testing-library/user-event": "^14.6.1",
|
||||||
"prop-types": "15.8.1",
|
"prop-types": "15.8.1",
|
||||||
"react": "17.0.2",
|
"react": "^18.3.1",
|
||||||
"react-dom": "17.0.2",
|
"react-dom": "^18.3.1",
|
||||||
"react-redux": "7.2.9",
|
"react-redux": "8.1.3",
|
||||||
"react-router-dom": "6.21.3",
|
"react-router-dom": "6.30.0",
|
||||||
"react-test-renderer": "17.0.2",
|
"react-test-renderer": "18.3.1",
|
||||||
"redux": "4.2.1",
|
"redux": "4.2.1",
|
||||||
"semantic-release": "21.1.2"
|
"semantic-release": "21.1.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/fontawesome-svg-core": "6.5.1",
|
"@fortawesome/fontawesome-svg-core": "6.7.2",
|
||||||
"@fortawesome/free-brands-svg-icons": "6.5.1",
|
"@fortawesome/free-brands-svg-icons": "6.7.2",
|
||||||
"@fortawesome/free-regular-svg-icons": "6.5.1",
|
"@fortawesome/free-regular-svg-icons": "6.7.2",
|
||||||
"@fortawesome/free-solid-svg-icons": "6.5.1",
|
"@fortawesome/free-solid-svg-icons": "6.7.2",
|
||||||
"@fortawesome/react-fontawesome": "0.2.0",
|
"@fortawesome/react-fontawesome": "0.2.2",
|
||||||
"lodash": "^4.17.21"
|
"@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": {
|
"peerDependencies": {
|
||||||
"@edx/frontend-platform": "^7.0.0",
|
"@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",
|
"prop-types": "^15.5.10",
|
||||||
"react": "^16.9.0 || ^17.0.0",
|
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
|
||||||
"react-dom": "^16.9.0 || ^17.0.0"
|
"react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
$gray-footer: #fcfcfc !default;
|
$gray-footer: #fcfcfc !default;
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
background-color: $gray-footer;
|
background-color: var(--pgn-color-light-100, $gray-footer);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
/* eslint-disable react/prop-types */
|
/* eslint-disable react/prop-types */
|
||||||
import React, { useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import renderer from 'react-test-renderer';
|
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 { IntlProvider } from '@edx/frontend-platform/i18n';
|
||||||
import { AppContext } from '@edx/frontend-platform/react';
|
import { AppContext } from '@edx/frontend-platform/react';
|
||||||
|
|
||||||
import Footer from './Footer';
|
import Footer from './Footer';
|
||||||
|
import FooterSlot from '../plugin-slots/FooterSlot';
|
||||||
|
|
||||||
const FooterWithContext = ({ locale = 'es' }) => {
|
const FooterWithContext = ({ locale = 'es' }) => {
|
||||||
const contextValue = useMemo(() => ({
|
const contextValue = useMemo(() => ({
|
||||||
@@ -21,7 +23,7 @@ const FooterWithContext = ({ locale = 'es' }) => {
|
|||||||
<AppContext.Provider
|
<AppContext.Provider
|
||||||
value={contextValue}
|
value={contextValue}
|
||||||
>
|
>
|
||||||
<Footer />
|
<FooterSlot />
|
||||||
</AppContext.Provider>
|
</AppContext.Provider>
|
||||||
</IntlProvider>
|
</IntlProvider>
|
||||||
);
|
);
|
||||||
@@ -76,19 +78,13 @@ describe('<Footer />', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('handles language switching', () => {
|
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();
|
const mockHandleLanguageSelected = jest.fn();
|
||||||
render(<FooterWithLanguageSelector languageSelected={mockHandleLanguageSelected} />);
|
render(<FooterWithLanguageSelector languageSelected={mockHandleLanguageSelected} />);
|
||||||
|
|
||||||
fireEvent.submit(screen.getByTestId('site-footer-submit-btn'), {
|
await user.selectOptions(screen.getByRole('combobox'), 'es');
|
||||||
target: {
|
await user.click(screen.getByTestId('site-footer-submit-btn'));
|
||||||
elements: {
|
|
||||||
'site-footer-language-select': {
|
|
||||||
value: 'es',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(mockHandleLanguageSelected).toHaveBeenCalledWith('es');
|
expect(mockHandleLanguageSelected).toHaveBeenCalledWith('es');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ exports[`<Footer /> renders correctly renders with a language selector 1`] = `
|
|||||||
alt="Powered by Open edX"
|
alt="Powered by Open edX"
|
||||||
src="https://edx-cdn.org/v3/default/logo-trademark.svg"
|
src="https://edx-cdn.org/v3/default/logo-trademark.svg"
|
||||||
style={
|
style={
|
||||||
Object {
|
{
|
||||||
"maxHeight": 45,
|
"maxHeight": 45,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ exports[`<Footer /> renders correctly renders without a language selector 1`] =
|
|||||||
alt="Powered by Open edX"
|
alt="Powered by Open edX"
|
||||||
src="https://edx-cdn.org/v3/default/logo-trademark.svg"
|
src="https://edx-cdn.org/v3/default/logo-trademark.svg"
|
||||||
style={
|
style={
|
||||||
Object {
|
{
|
||||||
"maxHeight": 45,
|
"maxHeight": 45,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -116,7 +116,7 @@ exports[`<Footer /> renders correctly renders without a language selector in es
|
|||||||
alt="Powered by Open edX"
|
alt="Powered by Open edX"
|
||||||
src="https://edx-cdn.org/v3/default/logo-trademark.svg"
|
src="https://edx-cdn.org/v3/default/logo-trademark.svg"
|
||||||
style={
|
style={
|
||||||
Object {
|
{
|
||||||
"maxHeight": 45,
|
"maxHeight": 45,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { useContext, useState } from 'react';
|
import React, { useContext, useState } from 'react';
|
||||||
import _ from 'lodash';
|
import isEmpty from 'lodash/isEmpty';
|
||||||
import { intlShape, injectIntl, FormattedMessage } from '@edx/frontend-platform/i18n';
|
import { useIntl, FormattedMessage } from '@edx/frontend-platform/i18n';
|
||||||
import { ensureConfig } from '@edx/frontend-platform';
|
import { ensureConfig } from '@edx/frontend-platform';
|
||||||
import { AppContext } from '@edx/frontend-platform/react';
|
import { AppContext } from '@edx/frontend-platform/react';
|
||||||
import {
|
import {
|
||||||
@@ -8,11 +8,14 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
Container,
|
Container,
|
||||||
Hyperlink,
|
Hyperlink,
|
||||||
Image,
|
|
||||||
TransitionReplace,
|
TransitionReplace,
|
||||||
} from '@openedx/paragon';
|
} from '@openedx/paragon';
|
||||||
import { ExpandLess, ExpandMore, Help } from '@openedx/paragon/icons';
|
import { ExpandLess, ExpandMore, Help } from '@openedx/paragon/icons';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
import messages from './messages';
|
import messages from './messages';
|
||||||
|
import StudioFooterLogoSlot from '../../plugin-slots/StudioFooterLogoSlot';
|
||||||
|
|
||||||
ensureConfig([
|
ensureConfig([
|
||||||
'LMS_BASE_URL',
|
'LMS_BASE_URL',
|
||||||
@@ -26,12 +29,14 @@ ensureConfig([
|
|||||||
], 'Studio Footer component');
|
], 'Studio Footer component');
|
||||||
|
|
||||||
const StudioFooter = ({
|
const StudioFooter = ({
|
||||||
// injected
|
containerProps,
|
||||||
intl,
|
|
||||||
}) => {
|
}) => {
|
||||||
|
const intl = useIntl();
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const { config } = useContext(AppContext);
|
const { config } = useContext(AppContext);
|
||||||
|
|
||||||
|
const { containerClassName, ...restContainerProps } = containerProps || {};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="m-0 mt-6 row align-items-center justify-content-center">
|
<div className="m-0 mt-6 row align-items-center justify-content-center">
|
||||||
@@ -49,17 +54,21 @@ const StudioFooter = ({
|
|||||||
</Button>
|
</Button>
|
||||||
<div className="col border-top ml-2" />
|
<div className="col border-top ml-2" />
|
||||||
</div>
|
</div>
|
||||||
<Container size="xl" className="px-4">
|
<Container
|
||||||
|
size="xl"
|
||||||
|
className={classNames('px-4', containerClassName)}
|
||||||
|
{...restContainerProps}
|
||||||
|
>
|
||||||
<TransitionReplace>
|
<TransitionReplace>
|
||||||
{isOpen ? (
|
{isOpen ? (
|
||||||
<ActionRow key="help-link-button-row" className="py-4" data-testid="helpButtonRow">
|
<ActionRow key="help-link-button-row" className="py-4" data-testid="helpButtonRow">
|
||||||
<ActionRow.Spacer />
|
<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} />
|
<FormattedMessage {...messages.edxDocumentationButtonLabel} />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
as="a"
|
as="a"
|
||||||
href="https://open.edx.org/"
|
href="https://openedx.org/"
|
||||||
size="sm"
|
size="sm"
|
||||||
data-testid="openEdXPortalButton"
|
data-testid="openEdXPortalButton"
|
||||||
>
|
>
|
||||||
@@ -79,7 +88,7 @@ const StudioFooter = ({
|
|||||||
>
|
>
|
||||||
<FormattedMessage {...messages.studioXButtonLabel} />
|
<FormattedMessage {...messages.studioXButtonLabel} />
|
||||||
</Button>
|
</Button>
|
||||||
{!_.isEmpty(config.SUPPORT_EMAIL) && (
|
{!isEmpty(config.SUPPORT_EMAIL) && (
|
||||||
<Button
|
<Button
|
||||||
as="a"
|
as="a"
|
||||||
href={`mailto:${config.SUPPORT_EMAIL}`}
|
href={`mailto:${config.SUPPORT_EMAIL}`}
|
||||||
@@ -96,11 +105,11 @@ const StudioFooter = ({
|
|||||||
<ActionRow className="pt-3 m-0 x-small">
|
<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>
|
© {new Date().getFullYear()} <Hyperlink destination={config.MARKETING_SITE_BASE_URL} target="_blank" className="ml-2">{config.SITE_NAME}</Hyperlink>
|
||||||
<ActionRow.Spacer />
|
<ActionRow.Spacer />
|
||||||
{!_.isEmpty(config.TERMS_OF_SERVICE_URL) && (
|
{!isEmpty(config.TERMS_OF_SERVICE_URL) && (
|
||||||
<Hyperlink destination={config.TERMS_OF_SERVICE_URL} data-testid="termsOfService">
|
<Hyperlink destination={config.TERMS_OF_SERVICE_URL} data-testid="termsOfService">
|
||||||
{intl.formatMessage(messages.termsOfServiceLinkLabel)}
|
{intl.formatMessage(messages.termsOfServiceLinkLabel)}
|
||||||
</Hyperlink>
|
</Hyperlink>
|
||||||
)}{!_.isEmpty(config.PRIVACY_POLICY_URL) && (
|
)}{!isEmpty(config.PRIVACY_POLICY_URL) && (
|
||||||
<Hyperlink destination={config.PRIVACY_POLICY_URL} data-testid="privacyPolicy">
|
<Hyperlink destination={config.PRIVACY_POLICY_URL} data-testid="privacyPolicy">
|
||||||
{intl.formatMessage(messages.privacyPolicyLinkLabel)}
|
{intl.formatMessage(messages.privacyPolicyLinkLabel)}
|
||||||
</Hyperlink>
|
</Hyperlink>
|
||||||
@@ -125,13 +134,7 @@ const StudioFooter = ({
|
|||||||
<FormattedMessage {...messages.trademarkMessage} />
|
<FormattedMessage {...messages.trademarkMessage} />
|
||||||
<Hyperlink className="ml-1" destination="https://www.edx.org">edX Inc</Hyperlink>.
|
<Hyperlink className="ml-1" destination="https://www.edx.org">edX Inc</Hyperlink>.
|
||||||
<ActionRow.Spacer />
|
<ActionRow.Spacer />
|
||||||
<Hyperlink destination="https://open.edx.org" className="float-right">
|
<StudioFooterLogoSlot />
|
||||||
<Image
|
|
||||||
width="120px"
|
|
||||||
alt="Powered by Open edX"
|
|
||||||
src="https://logos.openedx.org/open-edx-logo-tag.png"
|
|
||||||
/>
|
|
||||||
</Hyperlink>
|
|
||||||
</ActionRow>
|
</ActionRow>
|
||||||
</Container>
|
</Container>
|
||||||
</>
|
</>
|
||||||
@@ -139,8 +142,11 @@ const StudioFooter = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
StudioFooter.propTypes = {
|
StudioFooter.propTypes = {
|
||||||
// injected
|
containerProps: PropTypes.shape(Container.propTypes),
|
||||||
intl: intlShape.isRequired,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default injectIntl(StudioFooter);
|
StudioFooter.defaultProps = {
|
||||||
|
containerProps: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default StudioFooter;
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
/* eslint-disable react/prop-types */
|
/* eslint-disable react/prop-types */
|
||||||
import React, { useMemo } from 'react';
|
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 '@testing-library/jest-dom/extend-expect';
|
||||||
import { IntlProvider } from '@edx/frontend-platform/i18n';
|
import { IntlProvider } from '@edx/frontend-platform/i18n';
|
||||||
import { AppContext } from '@edx/frontend-platform/react';
|
import { AppContext } from '@edx/frontend-platform/react';
|
||||||
import StudioFooter from './StudioFooter';
|
import StudioFooterSlot from '../../plugin-slots/StudioFooterSlot';
|
||||||
import messages from './messages';
|
import messages from './messages';
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
@@ -35,7 +36,7 @@ const Component = ({ updateVariable }) => {
|
|||||||
return (
|
return (
|
||||||
<IntlProvider locale="en">
|
<IntlProvider locale="en">
|
||||||
<AppContext.Provider value={contextValue}>
|
<AppContext.Provider value={contextValue}>
|
||||||
<StudioFooter />
|
<StudioFooterSlot />
|
||||||
</AppContext.Provider>
|
</AppContext.Provider>
|
||||||
</IntlProvider>
|
</IntlProvider>
|
||||||
);
|
);
|
||||||
@@ -56,35 +57,40 @@ describe('Footer', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('help section expanded view', () => {
|
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 />);
|
render(<Component />);
|
||||||
const helpToggleButton = screen.getByText(messages.openHelpButtonLabel.defaultMessage);
|
const helpToggleButton = screen.getByText(messages.openHelpButtonLabel.defaultMessage);
|
||||||
fireEvent.click(helpToggleButton);
|
await user.click(helpToggleButton);
|
||||||
expect(screen.getByText(messages.closeHelpButtonLabel.defaultMessage))
|
expect(screen.getByText(messages.closeHelpButtonLabel.defaultMessage))
|
||||||
.toBeVisible();
|
.toBeVisible();
|
||||||
});
|
});
|
||||||
it('help button link row should be visible', () => {
|
it('help button link row should be visible', async () => {
|
||||||
|
const user = userEvent.setup();
|
||||||
render(<Component />);
|
render(<Component />);
|
||||||
const helpToggleButton = screen.getByText(messages.openHelpButtonLabel.defaultMessage);
|
const helpToggleButton = screen.getByText(messages.openHelpButtonLabel.defaultMessage);
|
||||||
fireEvent.click(helpToggleButton);
|
await user.click(helpToggleButton);
|
||||||
expect(screen.getByTestId('helpButtonRow')).toBeVisible();
|
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 />);
|
render(<Component />);
|
||||||
const helpToggleButton = screen.getByText(messages.openHelpButtonLabel.defaultMessage);
|
const helpToggleButton = screen.getByText(messages.openHelpButtonLabel.defaultMessage);
|
||||||
fireEvent.click(helpToggleButton);
|
await user.click(helpToggleButton);
|
||||||
expect(screen.getByTestId('openEdXPortalButton')).toBeVisible();
|
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 />);
|
render(<Component />);
|
||||||
const helpToggleButton = screen.getByText(messages.openHelpButtonLabel.defaultMessage);
|
const helpToggleButton = screen.getByText(messages.openHelpButtonLabel.defaultMessage);
|
||||||
fireEvent.click(helpToggleButton);
|
await user.click(helpToggleButton);
|
||||||
expect(screen.queryByTestId('contactUsButton')).toBeNull();
|
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']} />);
|
render(<Component updateVariable={['SUPPORT_EMAIL', 'support@email.com']} />);
|
||||||
const helpToggleButton = screen.getByText(messages.openHelpButtonLabel.defaultMessage);
|
const helpToggleButton = screen.getByText(messages.openHelpButtonLabel.defaultMessage);
|
||||||
fireEvent.click(helpToggleButton);
|
await user.click(helpToggleButton);
|
||||||
expect(screen.getByTestId('contactUsButton')).toBeVisible();
|
expect(screen.getByTestId('contactUsButton')).toBeVisible();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,34 +1 @@
|
|||||||
import arMessages from './messages/ar.json';
|
export default {};
|
||||||
import frMessages from './messages/fr.json';
|
|
||||||
import es419Messages from './messages/es_419.json';
|
|
||||||
import zhcnMessages from './messages/zh_CN.json';
|
|
||||||
import ptMessages from './messages/pt.json';
|
|
||||||
import itMessages from './messages/it.json';
|
|
||||||
import ukMessages from './messages/uk.json';
|
|
||||||
import deMessages from './messages/de.json';
|
|
||||||
import ruMessages from './messages/ru.json';
|
|
||||||
import hiMessages from './messages/hi.json';
|
|
||||||
import frCAMessages from './messages/fr_CA.json';
|
|
||||||
import dedeCAMessages from './messages/de_DE.json';
|
|
||||||
import ititCAMessages from './messages/it_IT.json';
|
|
||||||
import ptptCAMessages from './messages/pt_PT.json';
|
|
||||||
// no need to import en messages-- they are in the defaultMessage field
|
|
||||||
|
|
||||||
const messages = {
|
|
||||||
ar: arMessages,
|
|
||||||
'es-419': es419Messages,
|
|
||||||
fr: frMessages,
|
|
||||||
'zh-cn': zhcnMessages,
|
|
||||||
pt: ptMessages,
|
|
||||||
it: itMessages,
|
|
||||||
de: deMessages,
|
|
||||||
hi: hiMessages,
|
|
||||||
'fr-ca': frCAMessages,
|
|
||||||
ru: ruMessages,
|
|
||||||
uk: ukMessages,
|
|
||||||
'de-de': dedeCAMessages,
|
|
||||||
'it-it': ititCAMessages,
|
|
||||||
'pt-pt': ptptCAMessages,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default messages;
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@@ -1,6 +1,10 @@
|
|||||||
import Footer, { EVENT_NAMES } from './components/Footer';
|
import Footer, { EVENT_NAMES } from './components/Footer';
|
||||||
import messages from './i18n/index';
|
import messages from './i18n/index';
|
||||||
import StudioFooter from './components/studio-footer';
|
import StudioFooter from './components/studio-footer';
|
||||||
|
import FooterSlot from './plugin-slots/FooterSlot';
|
||||||
|
import StudioFooterSlot from './plugin-slots/StudioFooterSlot';
|
||||||
|
|
||||||
export default Footer;
|
export default Footer;
|
||||||
export { messages, EVENT_NAMES, StudioFooter };
|
export {
|
||||||
|
messages, EVENT_NAMES, StudioFooter, FooterSlot, StudioFooterSlot,
|
||||||
|
};
|
||||||
|
|||||||
51
src/plugin-slots/FooterSlot/README.md
Normal file
51
src/plugin-slots/FooterSlot/README.md
Normal 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.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
with a simple custom footer
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
```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;
|
||||||
|
```
|
||||||
BIN
src/plugin-slots/FooterSlot/images/custom_footer.png
Normal file
BIN
src/plugin-slots/FooterSlot/images/custom_footer.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.2 KiB |
BIN
src/plugin-slots/FooterSlot/images/default_footer.png
Normal file
BIN
src/plugin-slots/FooterSlot/images/default_footer.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.5 KiB |
14
src/plugin-slots/FooterSlot/index.jsx
Normal file
14
src/plugin-slots/FooterSlot/index.jsx
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
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_plugin_slot']}
|
||||||
|
>
|
||||||
|
<Footer />
|
||||||
|
</PluginSlot>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default FooterSlot;
|
||||||
5
src/plugin-slots/README.md
Normal file
5
src/plugin-slots/README.md
Normal 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/)
|
||||||
57
src/plugin-slots/StudioFooterLogoSlot/README.md
Normal file
57
src/plugin-slots/StudioFooterLogoSlot/README.md
Normal 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.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
```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 |
17
src/plugin-slots/StudioFooterLogoSlot/index.jsx
Normal file
17
src/plugin-slots/StudioFooterLogoSlot/index.jsx
Normal 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;
|
||||||
51
src/plugin-slots/StudioFooterSlot/README.md
Normal file
51
src/plugin-slots/StudioFooterSlot/README.md
Normal 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.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
with a simple custom footer
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
```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;
|
||||||
|
```
|
||||||
BIN
src/plugin-slots/StudioFooterSlot/images/custom_footer.png
Normal file
BIN
src/plugin-slots/StudioFooterSlot/images/custom_footer.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 79 KiB |
11
src/plugin-slots/StudioFooterSlot/index.jsx
Normal file
11
src/plugin-slots/StudioFooterSlot/index.jsx
Normal 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;
|
||||||
@@ -2,7 +2,9 @@ const path = require('path');
|
|||||||
const { createConfig } = require('@openedx/frontend-build');
|
const { createConfig } = require('@openedx/frontend-build');
|
||||||
|
|
||||||
module.exports = createConfig('webpack-dev', {
|
module.exports = createConfig('webpack-dev', {
|
||||||
entry: path.resolve(__dirname, 'example'),
|
entry: {
|
||||||
|
app: path.resolve(__dirname, 'example'),
|
||||||
|
},
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(__dirname, 'example/dist'),
|
path: path.resolve(__dirname, 'example/dist'),
|
||||||
publicPath: '/',
|
publicPath: '/',
|
||||||
|
|||||||
Reference in New Issue
Block a user