Compare commits

..

1 Commits

Author SHA1 Message Date
David Joy
40264e087d refactor: use paragon hyperlink again 2019-07-05 09:45:21 -04:00
50 changed files with 27089 additions and 18028 deletions

28
.babelrc Normal file
View File

@@ -0,0 +1,28 @@
{
"presets": [
["env", {
"targets": {
"browsers": ["last 2 versions", "ie 11"]
}
}],
"babel-preset-react"
],
"plugins": [
"transform-object-rest-spread"
],
"env": {
"test": {
"plugins": [
"rewire"
]
},
"i18n": {
"plugins": [
["react-intl", {
"messagesDir": "./temp/babel-plugin-react-intl",
"moduleSourceName": "@edx/frontend-i18n"
}]
]
}
}
}

View File

@@ -1,19 +0,0 @@
ACCESS_TOKEN_COOKIE_NAME=edx-jwt-cookie-header-payload
BASE_URL=localhost:8080
CREDENTIALS_BASE_URL=http://localhost:18150
CSRF_TOKEN_API_PATH=/csrf/api/v1/token
ECOMMERCE_BASE_URL=http://localhost:18130
LANGUAGE_PREFERENCE_COOKIE_NAME=openedx-language-preference
LMS_BASE_URL=http://localhost:18000
LOGIN_URL=http://localhost:18000/login
LOGOUT_URL=http://localhost:18000/login
MARKETING_SITE_BASE_URL=http://localhost:18000
ORDER_HISTORY_URL=localhost:1996/orders
REFRESH_ACCESS_TOKEN_ENDPOINT=http://localhost:18000/login_refresh
SEGMENT_KEY=null
SITE_NAME=Open edX
USER_INFO_COOKIE_NAME=edx-user-info
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

View File

@@ -1,4 +1,3 @@
coverage
dist
example
node_modules

View File

@@ -1,3 +0,0 @@
const { createConfig } = require('@edx/frontend-build');
module.exports = createConfig('eslint');

19
.eslintrc.json Normal file
View File

@@ -0,0 +1,19 @@
{
"extends": "eslint-config-edx",
"rules": {
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": [
"webpack.config.js",
"src/tests/setupTest.js",
"**/*.test.jsx",
"**/*.test.js"
]
}
]
},
"env": {
"jest": true
}
}

1
.github/CODEOWNERS vendored
View File

@@ -1 +0,0 @@
* @edx/community-engineering

View File

@@ -1,19 +0,0 @@
# Run the workflow that adds new tickets that are either:
# - labelled "DEPR"
# - title starts with "[DEPR]"
# - body starts with "Proposal Date" (this is the first template field)
# to the org-wide DEPR project board
name: Add newly created DEPR issues to the DEPR project board
on:
issues:
types: [opened]
jobs:
routeissue:
uses: openedx/.github/.github/workflows/add-depr-ticket-to-depr-board.yml@master
secrets:
GITHUB_APP_ID: ${{ secrets.GRAPHQL_AUTH_APP_ID }}
GITHUB_APP_PRIVATE_KEY: ${{ secrets.GRAPHQL_AUTH_APP_PEM }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_ISSUE_BOT_TOKEN }}

View File

@@ -1,35 +0,0 @@
name: Default CI
on:
push:
branches:
- 'master'
pull_request:
branches:
- '**'
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
node: [12, 14, 16]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Nodejs
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
run: npm ci
- name: Validate package-lock.json changes
run: make validate-no-uncommitted-package-lock-changes
- name: Lint
run: npm run lint
- name: Test
run: npm run test
- name: i18n_extract
run: npm run i18n_extract
- name: Coverage
uses: codecov/codecov-action@v2

View File

@@ -1,10 +0,0 @@
# Run commitlint on the commit messages in a pull request.
name: Lint Commit Messages
on:
- pull_request
jobs:
commitlint:
uses: edx/.github/.github/workflows/commitlint.yml@master

View File

@@ -1,37 +0,0 @@
name: Release CI
on:
push:
branches:
- master
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 12
- name: Install dependencies
run: npm ci
- name: Validate package-lock.json changes
run: make validate-no-uncommitted-package-lock-changes
- name: Lint
run: npm run lint
- name: Test
run: npm run test
- name: i18n_extract
run: npm run i18n_extract
- name: Coverage
uses: codecov/codecov-action@v2
- name: Build
run: npm run build
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
run: npx semantic-release

3
.gitignore vendored
View File

@@ -1,4 +1,3 @@
.DS_Store
coverage
dist
node_modules
@@ -8,5 +7,3 @@ temp
src/i18n/transifex_input.json
temp/babel-plugin-react-intl
/.vscode
module.config.js

21
.travis.yml Normal file
View File

@@ -0,0 +1,21 @@
language: node_js
node_js:
- 8
cache:
directories:
- "~/.npm"
install:
- npm install
script:
- npm run lint
- npm run i18n_extract
- npm run test
- npm run build
- npm run is-es5
after_success:
- npm run travis-deploy-once "npm run semantic-release"
- npm run coveralls
env:
global:
- secure: dxQadqP6tsoJzHcqs/Hs5AjE42z45q8ZeWKP5HcjbXoJURB4gc1uIxLky0FA6ZpulaTgRVTLcWQbx9yOODc9PQuFnFEDWlCg5EP8tONzeu7BVlJvV5eakgGUhl9w2pekBKsTGhK5dDg2y2D8bGfIL55UX81uiWeytp8s/y8QNs/FNXx9ScJnfhnC+2RfW52fB7iW12F1VYdQfVe43o5PsHze+YhB3FU/ztGe3iMaQiq9QplZWpvqQMpI7pTjyUAX8ITiiPS6UvLFObgpXpfjZdgd+yveFoi3z8o8F0NkmzBphFeSYFjFZE0qJ8bnGNIZldanMeuUgHmDeTwVmKQFhH2LqqnfcdGgW6UsKcHkSN1G51zzad2dEwAHrgxj1NkMp3JfEed2C7Kvntl6KRjVDmYZqHJvt+e+AHNbpjzblOW8tYMIrdz0TeJdk4D9pP3B3tRCtP6fvQ3GLzAMnaCrSsN6hZ9YVxWku8sg8WNEDHl14sZsdgk312MlHIdiUw97FHGrqx/NCix4IkUlCBDbKYbKzbZp20FfzZcwNRNH74+k6xpOnMGSfq8gByEhm9y02MBL76HiAI2VGct2La1ExaUfoikYGoNaZpFcZyOZKo6PYTYHpiUJmqrEnDyVQEOOXUaVsxWXwnYq/mU4nOEPKCRbNpPoksZdNxf6jlmMi8s=
- secure: lrlV0WQaXTRJ2lqDkFZ+1RkRb7YM/STOViOHUNboXb5+1ReVwY0wklFDVk/Qigp3jkbqWfzkBmEjSDVGDLD61QjpGY4BsxZ/Jn3+KUdo0n82Ym6cI/je1fH2gqDLi4U8bylmnkI5oEjV/1txDxkj4hF5w/Leo/oGue3xQohpi//ihhm/PxzExj+QiDqyZPZ5RQZeqLfPEU3Wff04vLE5bRmy1nDTZrgm5Wb1n5ItGsyrUyrCGuAM9kIEun65Snb8hxCuU9pSm1w/xF73iOGLiiC8KZhLu6SxSKoC872ai1GpUXNIqA8kpVeH0Erf5opMtqJT3jTTan/VOFQEoOeAKhR0ga+5rfK2jkhhN77B98dGVndNCfBpDlgQxVv42H6riFk3payZT262QiUqDejiBDtSPTokTGxf7xFtQkQQahhxVXzC2HRKEkDTXNSP8cvk2JJ4zCcUgxJpycudLMuC/Xv0upK+Q0caItBrHxfVNnRKkjKqlDxRhA8nXTY8d2n19FNi7wahCECbyweJJ76EaJaa/Ib6remUBrbGLoQ2PkaSMBHAcn3+7+H/6x11b2s1RHj5qyfIyrvZcDDyNuxdXwpOkhtrkwZsjgtOfXL6IuxW5FExgPPr8B9nNwJJKdTxyxgfqtwBR5+m9nrMixzT6AMe95torZ6eX40gKZ/O9EU=

View File

@@ -10,14 +10,6 @@ tx_url2 = https://www.transifex.com/api/2/project/edx-platform/resource/$(transi
# This directory must match .babelrc .
transifex_temp = ./temp/babel-plugin-react-intl
build:
rm -rf ./dist
./node_modules/.bin/fedx-scripts babel src --out-dir dist --source-maps --ignore **/*.test.jsx,**/__mocks__,**/__snapshots__,**/setupTest.js --copy-files
@# --copy-files will bring in everything else that wasn't processed by babel. Remove what we don't want.
@rm -rf dist/**/*.test.jsx
@rm -rf dist/**/__snapshots__
@rm -rf dist/__mocks__
requirements:
npm install

View File

@@ -1,95 +1,45 @@
#########################
frontend-component-footer
#########################
=========================
|Build Status| |Codecov| |npm_version| |npm_downloads| |license| |semantic-release|
|Build Status| |Coveralls| |npm_version| |npm_downloads| |license|
|semantic-release|
********
Overview
********
frontend-component-footer is a library containing a site footer
component for use when building edX frontend applications.
A generic footer for Open edX micro-frontend applications. It includes a logo and an optional language selector dropdown.
At this time, this component is hard-coded to match the legacy LMS site footer, including all of its links. As implemented, this component should probably be called the ``frontend-component-lms-footer``.
************
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. <https://github.com/edx/frontend-template-application/blob/3355bb3a96232390e9056f35b06ffa8f105ed7ca/src/index.jsx>`_
Environment Variables
=====================
This component requires that the following environment variable be set by the consuming micro-frontend.
* ``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.
*****
Usage
*****
-----
This library has the following exports:
To install frontend-component-footer into your project::
* ``(default)``: The footer as a React component.
* ``messages``: Internationalization messages suitable for use with `@edx/frontend-platform/i18n <https://edx.github.io/frontend-platform/module-Internationalization.html>`_
* ``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.
npm i --save @edx/frontend-component-footer
<Footer /> component props
==========================
The component expects properties specifying the various URLs that are
linked in the footer. See the sample app in `src/index.jsx <src/index.jsx>`__ for an example
of how the SiteFooter component can be specified.
* 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.
Requirements
------------
Examples
========
This component uses ``@edx/frontend-i18n``. Any containing app must provide ``@edx/frontend-i18n`` as a peer dependency, and be wrapped inside an ``IntlProvider`` element, whether or not your consuming application is actually localized. For a basic default locale (English) version, follow the ``IntlProvider`` example in the sample application in `src/index.jsx <src/index.jsx>`__.
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' },
]}
/>
* `An example of minimal component and messages usage. <https://github.com/edx/frontend-template-application/blob/3355bb3a96232390e9056f35b06ffa8f105ed7ca/src/index.jsx#L23>`_
* `An example of SCSS file usage. <https://github.com/edx/frontend-template-application/blob/3cd5485bf387b8c479baf6b02bf59e3061dc3465/src/index.scss#L9>`_
***********
Development
***********
-----------
Install dependencies::
Start the dev server::
npm i
npm i && npm start
Start the development server::
Build the component::
npm start
npm run build
Build a production distribution::
npm run build
.. |Build Status| image:: https://api.travis-ci.com/edx/frontend-component-footer.svg?branch=master
:target: https://travis-ci.com/edx/frontend-component-footer
.. |Codecov| image:: https://img.shields.io/codecov/c/github/edx/frontend-component-footer
:target: @edx/frontend-component-footer
.. |Build Status| image:: https://api.travis-ci.org/edx/frontend-component-footer.svg?branch=master
:target: https://travis-ci.org/edx/frontend-component-footer
.. |Coveralls| image:: https://img.shields.io/coveralls/edx/frontend-component-footer.svg?branch=master
:target: https://coveralls.io/github/edx/frontend-component-footer
.. |npm_version| image:: https://img.shields.io/npm/v/@edx/frontend-component-footer.svg
:target: @edx/frontend-component-footer
.. |npm_downloads| image:: https://img.shields.io/npm/dt/@edx/frontend-component-footer.svg

View File

@@ -1,3 +0,0 @@
const { createConfig } = require('@edx/frontend-build');
module.exports = createConfig('babel-preserve-modules');

3
commitlint.config.js Normal file
View File

@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-angular'],
};

15
config/webpack.common.config.js Executable file
View File

@@ -0,0 +1,15 @@
// This is the common Webpack config. The dev and prod Webpack configs both
// inherit config defined here.
const path = require('path');
module.exports = {
entry: {
app: path.resolve(__dirname, '../src/index.jsx'),
},
output: {
path: path.resolve(__dirname, '../dist'),
},
resolve: {
extensions: ['.js', '.jsx'],
},
};

115
config/webpack.dev.config.js Executable file
View File

@@ -0,0 +1,115 @@
// This is the dev Webpack config. All settings here should prefer a fast build
// time at the expense of creating larger, unoptimized bundles.
const Merge = require('webpack-merge'); // eslint-disable-line import/no-extraneous-dependencies
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin'); // eslint-disable-line import/no-extraneous-dependencies
const webpack = require('webpack'); // eslint-disable-line import/no-extraneous-dependencies
const commonConfig = require('./webpack.common.config.js');
module.exports = Merge.smart(commonConfig, {
mode: 'development',
entry: [
// enable react's custom hot dev client so we get errors reported in the browser
require.resolve('react-dev-utils/webpackHotDevClient'),
path.resolve(__dirname, '../src/index.jsx'),
],
module: {
// Specify file-by-file rules to Webpack. Some file-types need a particular kind of loader.
rules: [
// The babel-loader transforms newer ES2015+ syntax to older ES5 for older browsers.
// Babel is configured with the .babelrc file at the root of the project.
{
test: /\.(js|jsx)$/,
include: [
path.resolve(__dirname, '../src'),
],
loader: 'babel-loader',
options: {
// Caches result of loader to the filesystem. Future builds will attempt to read from the
// cache to avoid needing to run the expensive recompilation process on each run.
cacheDirectory: true,
},
},
// We are not extracting CSS from the javascript bundles in development because extracting
// prevents hot-reloading from working, it increases build time, and we don't care about
// flash-of-unstyled-content issues in development.
{
test: /(.scss|.css)$/,
use: [
'style-loader', // creates style nodes from JS strings
{
loader: 'css-loader', // translates CSS into CommonJS
options: {
sourceMap: true,
},
},
{
loader: 'sass-loader', // compiles Sass to CSS
options: {
sourceMap: true,
includePaths: [
path.join(__dirname, '../node_modules'),
path.join(__dirname, '../src'),
],
},
},
],
},
// Webpack, by default, uses the url-loader for images and fonts that are required/included by
// files it processes, which just base64 encodes them and inlines them in the javascript
// bundles. This makes the javascript bundles ginormous and defeats caching so we will use the
// file-loader instead to copy the files directly to the output directory.
{
test: /\.(woff2?|ttf|svg|eot)(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader',
},
{
test: /\.(jpe?g|png|gif|ico)(\?v=\d+\.\d+\.\d+)?$/,
use: [
'file-loader',
{
loader: 'image-webpack-loader',
options: {
optimizationlevel: 7,
mozjpeg: {
progressive: true,
},
gifsicle: {
interlaced: false,
},
pngquant: {
quality: '65-90',
speed: 4,
},
},
},
],
},
],
},
// Specify additional processing or side-effects done on the Webpack output bundles as a whole.
plugins: [
// Generates an HTML file in the output directory.
new HtmlWebpackPlugin({
inject: true, // Appends script tags linking to the webpack bundles at the end of the body
template: path.resolve(__dirname, '../public/index.html'),
}),
new webpack.EnvironmentPlugin({
NODE_ENV: 'development',
}),
// when the --hot option is not passed in as part of the command
// the HotModuleReplacementPlugin has to be specified in the Webpack configuration
// https://webpack.js.org/configuration/dev-server/#devserver-hot
new webpack.HotModuleReplacementPlugin(),
],
// This configures webpack-dev-server which serves bundles from memory and provides live
// reloading.
devServer: {
host: '0.0.0.0',
port: 3000,
historyApiFallback: true,
hot: true,
inline: true,
},
});

71
config/webpack.prod.config.js Executable file
View File

@@ -0,0 +1,71 @@
// This is the prod Webpack config. All settings here should prefer smaller,
// optimized bundles at the expense of a longer build time.
const Merge = require('webpack-merge'); // eslint-disable-line import/no-extraneous-dependencies
const commonConfig = require('./webpack.common.config.js');
const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin'); // eslint-disable-line import/no-extraneous-dependencies
module.exports = Merge.smart(commonConfig, {
mode: 'production',
devtool: 'source-map',
entry: './src/lib/index.js',
output: {
path: path.resolve(__dirname, '../dist'),
library: 'frontend-component-footer',
libraryTarget: 'umd',
globalObject: 'typeof self !== \'undefined\' ? self : this',
},
resolve: {
extensions: ['.js', '.jsx'],
alias: {
react: path.resolve(__dirname, './node_modules/react'),
'react-dom': path.resolve(__dirname, './node_modules/react-dom'),
},
},
externals: {
react: {
commonjs: 'react',
commonjs2: 'react',
amd: 'React',
root: 'React',
},
'react-dom': {
commonjs: 'react-dom',
commonjs2: 'react-dom',
amd: 'ReactDOM',
root: 'ReactDOM',
},
'@edx/frontend-i18n': {
commonjs: '@edx/frontend-i18n',
commonjs2: '@edx/frontend-i18n',
amd: '@edx/frontend-i18n',
root: '@edx/frontend-i18n',
},
'@edx/frontend-logging': {
commonjs: '@edx/frontend-logging',
commonjs2: '@edx/frontend-logging',
amd: '@edx/frontend-logging',
root: '@edx/frontend-logging',
},
},
plugins: [
// Cleans the dist directory before each build
new CleanWebpackPlugin(['dist'], {
root: path.join(__dirname, '../'),
}),
],
module: {
rules: [
{
test: /\.(js|jsx)$/,
include: [
path.resolve(__dirname, '../src/lib'),
],
exclude: /(node_modules)/,
use: [
{ loader: 'babel-loader' },
],
},
],
},
});

View File

@@ -1,33 +0,0 @@
import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import { initialize, getConfig, subscribe, APP_READY } from '@edx/frontend-platform';
import { AppContext, AppProvider } from '@edx/frontend-platform/react';
import Footer from '@edx/frontend-component-footer';
import './index.scss';
subscribe(APP_READY, () => {
ReactDOM.render(
<AppProvider>
<AppContext.Provider value={{
authenticatedUser: null,
config: getConfig(),
}}>
<Footer
onLanguageSelected={() => {}}
supportedLanguages={[
{ label: 'English', value: 'en' },
{ label: 'Español', value: 'es' },
]}
/>
</AppContext.Provider>
</AppProvider>,
document.getElementById('root'),
);
});
initialize({
messages: []
});

View File

@@ -1,6 +0,0 @@
@import "@edx/brand/paragon/fonts";
@import "@edx/brand/paragon/variables";
@import "@edx/paragon/scss/core/core";
@import "@edx/brand/paragon/overrides";
@import "@edx/frontend-component-footer/footer";

View File

@@ -1,7 +0,0 @@
const { createConfig } = require('@edx/frontend-build');
module.exports = createConfig('jest', {
setupFiles: [
'<rootDir>/src/setupTest.js',
],
});

View File

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

39877
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,26 +1,29 @@
{
"name": "@edx/frontend-component-footer",
"version": "1.0.0-semantically-released",
"description": "Footer component for use when building Open edX frontend applications",
"main": "dist/index.js",
"description": "Site footer component for use when building edX frontend applications",
"main": "dist/main.js",
"module": "dist/main.js",
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "make build",
"i18n_extract": "BABEL_ENV=i18n fedx-scripts babel src --quiet > /dev/null",
"lint": "fedx-scripts eslint --ext .js --ext .jsx .",
"snapshot": "fedx-scripts jest --updateSnapshot",
"start": "fedx-scripts webpack-dev-server --progress",
"test": "fedx-scripts jest --coverage"
},
"files": [
"/dist"
],
"husky": {
"hooks": {
"pre-commit": "npm run lint"
}
"build": "NODE_ENV=production BABEL_ENV=production webpack --config=config/webpack.prod.config.js",
"build:stats": "NODE_ENV=production BABEL_ENV=production webpack --config=config/webpack.prod.config.js --profile --progress --json > stats.json",
"gc": "commit",
"commitmsg": "commitlint -e $GIT_PARAMS",
"coveralls": "cat ./coverage/lcov.info | coveralls",
"is-es5": "es-check es5 ./dist/*.js",
"i18n_extract": "BABEL_ENV=i18n babel src --quiet > /dev/null",
"lint": "eslint --ext .js --ext .jsx .",
"precommit": "npm run lint",
"prepublishOnly": "npm run build",
"semantic-release": "semantic-release",
"start": "NODE_ENV=development BABEL_ENV=development node_modules/.bin/webpack-dev-server --config=config/webpack.dev.config.js --progress",
"test": "jest --coverage",
"snapshot": "jest --updateSnapshot",
"travis-deploy-once": "travis-deploy-once",
"watch": "watch 'npm run build' ./src"
},
"repository": {
"type": "git",
@@ -33,35 +36,85 @@
},
"homepage": "https://github.com/edx/frontend-component-footer#readme",
"devDependencies": {
"@edx/brand": "npm:@edx/brand-openedx@1.1.0",
"@edx/frontend-build": "9.1.0",
"@edx/frontend-platform": "^1.14.1",
"@edx/paragon": "^16.0.0",
"codecov": "3.8.3",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.6",
"husky": "7.0.4",
"prop-types": "15.7.2",
"react": "16.14.0",
"react-dom": "16.14.0",
"react-redux": "7.2.6",
"react-router-dom": "5.3.0",
"react-test-renderer": "16.14.0",
"reactifex": "1.1.1",
"redux": "4.1.2",
"semantic-release": "^17.0.0"
"@commitlint/cli": "^7.1.2",
"@commitlint/config-angular": "^6.0.2",
"@commitlint/prompt": "^6.0.2",
"@commitlint/prompt-cli": "^6.0.2",
"@edx/edx-bootstrap": "^2.2.1",
"@edx/frontend-i18n": "^2.1.0",
"@edx/frontend-logging": "^2.0.2",
"@edx/paragon": "^6.1.0",
"@fortawesome/fontawesome-svg-core": "^1.2.17",
"@fortawesome/free-brands-svg-icons": "^5.8.1",
"@fortawesome/free-regular-svg-icons": "^5.8.1",
"@fortawesome/free-solid-svg-icons": "^5.8.1",
"@fortawesome/react-fontawesome": "^0.1.4",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-plugin-react-intl": "^3.0.1",
"babel-plugin-rewire": "^1.2.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"clean-webpack-plugin": "^0.1.19",
"coveralls": "^3.0.0",
"css-loader": "^0.28.9",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"es-check": "^5.0.0",
"eslint": "^5.2.0",
"eslint-config-edx": "^4.0.4",
"eslint-plugin-jsx-a11y": "^6.1.2",
"file-loader": "^1.1.9",
"glob": "^7.1.3",
"html-webpack-plugin": "^3.2.0",
"husky": "^0.14.3",
"image-webpack-loader": "^4.2.0",
"jest": "23.6.0",
"node-sass": "^4.7.2",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-dev-utils": "^5.0.0",
"react-dom": "^16.8.6",
"react-test-renderer": "^16.6.0",
"reactifex": "^1.1.1",
"sass-loader": "^6.0.6",
"semantic-release": "^15.1.7",
"source-map-loader": "^0.2.1",
"style-loader": "^0.20.2",
"travis-deploy-once": "^5.0.0",
"watch": "^1.0.2",
"webpack": "^4.19.1",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.9",
"webpack-merge": "^4.2.1"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "1.2.36",
"@fortawesome/free-brands-svg-icons": "5.15.4",
"@fortawesome/free-regular-svg-icons": "5.15.4",
"@fortawesome/free-solid-svg-icons": "5.15.4",
"@fortawesome/react-fontawesome": "0.1.16"
"query-string": "^5.1.1"
},
"peerDependencies": {
"@edx/frontend-platform": "^1.8.0",
"@edx/frontend-i18n": "^2.1.0",
"@edx/frontend-logging": "^2.0.2",
"@edx/paragon": "^6.1.0",
"prop-types": "^15.5.10",
"react": "^16.9.0",
"react-dom": "^16.9.0"
"react": "^16.4.2",
"react-dom": "^16.2.0"
},
"jest": {
"setupFiles": [
"./src/tests/setupTest.js"
],
"collectCoverageFrom": [
"src/lib/**/*.{js,jsx}",
"!src/tests/setupTest.js",
"!src/index.js",
"!**/node_modules/**",
"!**/tests/**"
],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|scss)$": "identity-obj-proxy"
}
}
}

View File

@@ -1,9 +1,9 @@
<!doctype html>
<html lang="en-us" dir="ltr">
<html lang="en-us">
<head>
<title>Footer</title>
<title>Footer | edX</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div id="root"></div>

View File

@@ -1,28 +0,0 @@
{
"extends": [
"config:base",
"schedule:weekly",
":automergeLinters",
":automergeMinor",
":automergeTesters",
":enableVulnerabilityAlerts",
":rebaseStalePrs",
":semanticCommits",
":updateNotScheduled"
],
"packageRules": [
{
"matchDepTypes": [
"devDependencies"
],
"matchUpdateTypes": [
"lockFileMaintenance",
"minor",
"patch",
"pin"
],
"automerge": true
}
],
"timezone": "America/New_York"
}

View File

@@ -1,5 +0,0 @@
$gray-footer: #fcfcfc !default;
.footer {
background-color: $gray-footer;
}

View File

@@ -1,102 +0,0 @@
import React from 'react';
import PropTypes from 'prop-types';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { sendTrackEvent } from '@edx/frontend-platform/analytics';
import { ensureConfig } from '@edx/frontend-platform/config';
import { AppContext } from '@edx/frontend-platform/react';
import messages from './Footer.messages';
import LanguageSelector from './LanguageSelector';
ensureConfig([
'LOGO_TRADEMARK_URL',
], 'Footer component');
const EVENT_NAMES = {
FOOTER_LINK: 'edx.bi.footer.link',
};
class SiteFooter extends React.Component {
constructor(props) {
super(props);
this.externalLinkClickHandler = this.externalLinkClickHandler.bind(this);
}
getLocalePrefix(locale) {
const twoLetterPrefix = locale.substring(0, 2).toLowerCase();
if (twoLetterPrefix === 'en') {
return '';
}
return `/${twoLetterPrefix}`;
}
externalLinkClickHandler(event) {
const label = event.currentTarget.getAttribute('href');
const eventName = EVENT_NAMES.FOOTER_LINK;
const properties = {
category: 'outbound_link',
label,
};
sendTrackEvent(eventName, properties);
}
render() {
const {
supportedLanguages,
onLanguageSelected,
logo,
intl,
} = this.props;
const showLanguageSelector = supportedLanguages.length > 0 && onLanguageSelected;
const { config } = this.context;
return (
<footer
role="contentinfo"
className="footer d-flex border-top py-3 px-4"
>
<div className="container-fluid d-flex">
<a
className="d-block"
href="https://open.edx.org"
aria-label={intl.formatMessage(messages['footer.logo.ariaLabel'])}
>
<img
style={{ maxHeight: 45 }}
src={logo || config.LOGO_TRADEMARK_URL}
alt={intl.formatMessage(messages['footer.logo.altText'])}
/>
</a>
<div className="flex-grow-1" />
{showLanguageSelector && (
<LanguageSelector
options={supportedLanguages}
onSubmit={onLanguageSelected}
/>
)}
</div>
</footer>
);
}
}
SiteFooter.contextType = AppContext;
SiteFooter.propTypes = {
intl: intlShape.isRequired,
logo: PropTypes.string,
onLanguageSelected: PropTypes.func,
supportedLanguages: PropTypes.arrayOf(PropTypes.shape({
label: PropTypes.string.isRequired,
value: PropTypes.string.isRequired,
})),
};
SiteFooter.defaultProps = {
logo: undefined,
onLanguageSelected: undefined,
supportedLanguages: [],
};
export default injectIntl(SiteFooter);
export { EVENT_NAMES };

View File

@@ -1,156 +0,0 @@
import { defineMessages } from '@edx/frontend-platform/i18n';
const messages = defineMessages({
'footer.socialLinks.srText.facebook': {
id: 'footer.socialLinks.srText.facebook',
defaultMessage: 'Like edX on Facebook',
description: 'This is screenreader text for the edX Facebook social media link in the footer.',
},
'footer.socialLinks.srText.twitter': {
id: 'footer.socialLinks.srText.twitter',
defaultMessage: 'Follow edX on Twitter',
description: 'This is screenreader text for the edX Twitter social media link in the footer.',
},
'footer.socialLinks.srText.youtube': {
id: 'footer.socialLinks.srText.youtube',
defaultMessage: 'Subscribe to the edX YouTube channel',
description: 'This is screenreader text for the edX YouTube social media link in the footer.',
},
'footer.socialLinks.srText.linkedin': {
id: 'footer.socialLinks.srText.linkedin',
defaultMessage: 'Follow edX on LinkedIn',
description: 'This is screenreader text for the edX LinkedIn social media link in the footer.',
},
'footer.socialLinks.srText.reddit': {
id: 'footer.socialLinks.srText.reddit',
defaultMessage: 'Subscribe to the edX subreddit',
description: 'This is screenreader text for the edX reddit social media link in the footer.',
},
'footer.languageForm.select.label': {
id: 'footer.languageForm.select.label',
defaultMessage: 'Choose Language',
description: 'The label for the laguage select part of the language selection form.',
},
'footer.languageForm.submit.label': {
id: 'footer.languageForm.submit.label',
defaultMessage: 'Apply',
description: 'The label for button to submit the language selection form.',
},
'footer.edxLinks.about': {
id: 'footer.edxLinks.about',
defaultMessage: 'About',
description: 'The label for the link to the about edX page.',
},
'footer.edxLinks.business': {
id: 'footer.edxLinks.business',
defaultMessage: 'edX for Business',
description: 'The label for the link to the edX for business page.',
},
'footer.edxLinks.affiliates': {
id: 'footer.edxLinks.affiliates',
defaultMessage: 'Affiliates',
description: 'The label for the link to the edX affiliates page.',
},
'footer.edxLinks.openEdx': {
id: 'footer.edxLinks.openEdx',
defaultMessage: 'Open edX',
description: 'The label for the link to the open edX site.',
},
'footer.edxLinks.careers': {
id: 'footer.edxLinks.careers',
defaultMessage: 'Careers',
description: 'The label for the link to the edX Careers page.',
},
'footer.edxLinks.news': {
id: 'footer.edxLinks.news',
defaultMessage: 'News',
description: 'The label for the link to the edX news page.',
},
'footer.legalLinks.heading': {
id: 'footer.legalLinks.heading',
defaultMessage: 'Legal',
description: 'Heading for the legal links section of the footer.',
},
'footer.legalLinks.termsOfService': {
id: 'footer.legalLinks.termsOfService',
defaultMessage: 'Terms of Service & Honor Code',
description: 'The label for the link to the edX terms of service page.',
},
'footer.legalLinks.privacyPolicy': {
id: 'footer.legalLinks.privacyPolicy',
defaultMessage: 'Privacy Policy',
description: 'The label for the link to the edX privacy policy page.',
},
'footer.legalLinks.a11yPolicy': {
id: 'footer.legalLinks.a11yPolicy',
defaultMessage: 'Accessibility Policy',
description: 'The label for the link to the edX accessibility policy page.',
},
'footer.legalLinks.trademarkPolicy': {
id: 'footer.legalLinks.trademarkPolicy',
defaultMessage: 'Trademark Policy',
description: 'The label for the link to the edX trademark policy page.',
},
'footer.legalLinks.sitemap': {
id: 'footer.legalLinks.sitemap',
defaultMessage: 'Sitemap',
description: 'The label for the link to the edX sitemap page.',
},
'footer.connectLinks.heading': {
id: 'footer.connectLinks.heading',
defaultMessage: 'Connect',
description: 'Heading for the connect links section of the footer.',
},
'footer.connectLinks.blog': {
id: 'footer.connectLinks.blog',
defaultMessage: 'Blog',
description: 'The label for the link to the edX blog.',
},
'footer.connectLinks.contact': {
id: 'footer.connectLinks.contact',
defaultMessage: 'Contact Us',
description: 'The label for the link to the contact edX page.',
},
'footer.connectLinks.help': {
id: 'footer.connectLinks.help',
defaultMessage: 'Help Center',
description: 'The label for the link to the edX help center.',
},
'footer.connectLinks.mediaKit': {
id: 'footer.connectLinks.mediaKit',
defaultMessage: 'Media Kit',
description: 'The label for the link to the edX media kit page.',
},
'footer.connectLinks.donate': {
id: 'footer.connectLinks.donate',
defaultMessage: 'Donate',
description: 'The label for the link to the edX donation page.',
},
'footer.mobileApp.apple': {
id: 'footer.mobileApp.apple',
defaultMessage: 'Download the edX mobile app from the Apple App Store',
description: 'The label for the link to download the apple version of the edX app.',
},
'footer.mobileApp.google': {
id: 'footer.mobileApp.google',
defaultMessage: 'Download the edX mobile app from Google Play',
description: 'The label for the link to download the google version of the edX app.',
},
'footer.logo.altText': {
id: 'footer.logo.altText',
defaultMessage: 'Powered by Open edX',
description: 'alt text for the footer logo.',
},
'footer.logo.ariaLabel': {
id: 'footer.logo.ariaLabel',
defaultMessage: 'edX Home',
description: 'aria-label for the footer logo.',
},
'footer.ariaLabel': {
id: 'footer.ariaLabel',
defaultMessage: 'Page Footer',
description: 'aria-label for the footer component',
},
});
export default messages;

View File

@@ -1,113 +0,0 @@
import React from 'react';
import renderer from 'react-test-renderer';
import { mount } from 'enzyme';
import { IntlProvider } from '@edx/frontend-platform/i18n';
import { AppContext } from '@edx/frontend-platform/react';
import Footer from './Footer';
describe('<Footer />', () => {
describe('renders correctly', () => {
it('renders without a language selector', () => {
const tree = renderer
.create((
<IntlProvider locale="en">
<AppContext.Provider
value={{
authenticatedUser: null,
config: {
LOGO_TRADEMARK_URL: process.env.LOGO_TRADEMARK_URL,
},
}}
>
<Footer />
</AppContext.Provider>
</IntlProvider>
))
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders without a language selector in es', () => {
const tree = renderer
.create((
<IntlProvider locale="es">
<AppContext.Provider
value={{
authenticatedUser: null,
config: {
LOGO_TRADEMARK_URL: process.env.LOGO_TRADEMARK_URL,
},
}}
>
<Footer />
</AppContext.Provider>
</IntlProvider>
))
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders with a language selector', () => {
const tree = renderer
.create((
<IntlProvider locale="en">
<AppContext.Provider
value={{
authenticatedUser: null,
config: {
LOGO_TRADEMARK_URL: process.env.LOGO_TRADEMARK_URL,
},
}}
>
<Footer
onLanguageSelected={() => {}}
supportedLanguages={[
{ label: 'English', value: 'en' },
{ label: 'Español', value: 'es' },
]}
/>
</AppContext.Provider>
</IntlProvider>
))
.toJSON();
expect(tree).toMatchSnapshot();
});
});
describe('handles language switching', () => {
it('calls onLanguageSelected prop when a language is changed', () => {
const mockHandleLanguageSelected = jest.fn();
const wrapper = mount((
<IntlProvider locale="en">
<AppContext.Provider
value={{
authenticatedUser: null,
config: {
LOGO_TRADEMARK_URL: process.env.LOGO_TRADEMARK_URL,
},
}}
>
<Footer
onLanguageSelected={mockHandleLanguageSelected}
supportedLanguages={[
{ label: 'English', value: 'en' },
{ label: 'Español', value: 'es' },
]}
/>
</AppContext.Provider>
</IntlProvider>
));
wrapper.find('form').simulate('submit', {
target: {
elements: {
'site-footer-language-select': {
value: 'es',
},
},
},
});
expect(mockHandleLanguageSelected).toHaveBeenCalledWith('es');
});
});
});

View File

@@ -1,58 +0,0 @@
import React from 'react';
import PropTypes from 'prop-types';
import { injectIntl, intlShape, FormattedMessage } from '@edx/frontend-platform/i18n';
const LanguageSelector = ({
intl, options, onSubmit, ...props
}) => {
const handleSubmit = (e) => {
e.preventDefault();
const languageCode = e.target.elements['site-footer-language-select'].value;
onSubmit(languageCode);
};
return (
<form
className="form-inline"
onSubmit={handleSubmit}
{...props}
>
<div className="form-group">
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
<label htmlFor="site-footer-language-select" className="d-inline-block m-0">
<FormattedMessage
id="footer.languageForm.select.label"
defaultMessage="Choose Language"
description="The label for the laguage select part of the language selection form."
/>
</label>
<select
id="site-footer-language-select"
className="form-control-sm mx-2"
name="site-footer-language-select"
defaultValue={intl.locale}
>
{options.map(({ value, label }) => <option key={value} value={value}>{label}</option>)}
</select>
<button className="btn btn-outline-primary btn-sm" type="submit">
<FormattedMessage
id="footer.languageForm.submit.label"
defaultMessage="Apply"
description="The label for button to submit the language selection form."
/>
</button>
</div>
</form>
);
};
LanguageSelector.propTypes = {
intl: intlShape.isRequired,
onSubmit: PropTypes.func.isRequired,
options: PropTypes.arrayOf(PropTypes.shape({
value: PropTypes.string,
label: PropTypes.string,
})).isRequired,
};
export default injectIntl(LanguageSelector);

View File

@@ -1,133 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<Footer /> renders correctly renders with a language selector 1`] = `
<footer
className="footer d-flex border-top py-3 px-4"
role="contentinfo"
>
<div
className="container-fluid d-flex"
>
<a
aria-label="edX Home"
className="d-block"
href="https://open.edx.org"
>
<img
alt="Powered by Open edX"
src="https://edx-cdn.org/v3/default/logo-trademark.svg"
style={
Object {
"maxHeight": 45,
}
}
/>
</a>
<div
className="flex-grow-1"
/>
<form
className="form-inline"
onSubmit={[Function]}
>
<div
className="form-group"
>
<label
className="d-inline-block m-0"
htmlFor="site-footer-language-select"
>
<span>
Choose Language
</span>
</label>
<select
className="form-control-sm mx-2"
defaultValue="en"
id="site-footer-language-select"
name="site-footer-language-select"
>
<option
value="en"
>
English
</option>
<option
value="es"
>
Español
</option>
</select>
<button
className="btn btn-outline-primary btn-sm"
type="submit"
>
<span>
Apply
</span>
</button>
</div>
</form>
</div>
</footer>
`;
exports[`<Footer /> renders correctly renders without a language selector 1`] = `
<footer
className="footer d-flex border-top py-3 px-4"
role="contentinfo"
>
<div
className="container-fluid d-flex"
>
<a
aria-label="edX Home"
className="d-block"
href="https://open.edx.org"
>
<img
alt="Powered by Open edX"
src="https://edx-cdn.org/v3/default/logo-trademark.svg"
style={
Object {
"maxHeight": 45,
}
}
/>
</a>
<div
className="flex-grow-1"
/>
</div>
</footer>
`;
exports[`<Footer /> renders correctly renders without a language selector in es 1`] = `
<footer
className="footer d-flex border-top py-3 px-4"
role="contentinfo"
>
<div
className="container-fluid d-flex"
>
<a
aria-label="edX Home"
className="d-block"
href="https://open.edx.org"
>
<img
alt="Powered by Open edX"
src="https://edx-cdn.org/v3/default/logo-trademark.svg"
style={
Object {
"maxHeight": 45,
}
}
/>
</a>
<div
className="flex-grow-1"
/>
</div>
</footer>
`;

BIN
src/edx-footer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -1,32 +1 @@
{
"footer.socialLinks.srText.facebook": "Like edX on Facebook",
"footer.socialLinks.srText.twitter": "Follow edX on Twitter",
"footer.socialLinks.srText.youtube": "Subscribe to the edX YouTube channel",
"footer.socialLinks.srText.linkedin": "Follow edX on LinkedIn",
"footer.socialLinks.srText.reddit": "Subscribe to the edX subreddit",
"footer.languageForm.select.label": "Choose Language",
"footer.languageForm.submit.label": "Apply",
"footer.edxLinks.about": "About",
"footer.edxLinks.business": "edX for Business",
"footer.edxLinks.affiliates": "Affiliates",
"footer.edxLinks.openEdx": "Open edX",
"footer.edxLinks.careers": "Careers",
"footer.edxLinks.news": "News",
"footer.legalLinks.heading": "Legal",
"footer.legalLinks.termsOfService": "Terms of Service & Honor Code",
"footer.legalLinks.privacyPolicy": "Privacy Policy",
"footer.legalLinks.a11yPolicy": "Accessibility Policy",
"footer.legalLinks.trademarkPolicy": "Trademark Policy",
"footer.legalLinks.sitemap": "Sitemap",
"footer.connectLinks.heading": "Connect",
"footer.connectLinks.blog": "Blog",
"footer.connectLinks.contact": "Contact Us",
"footer.connectLinks.help": "Help Center",
"footer.connectLinks.mediaKit": "Media Kit",
"footer.connectLinks.donate": "Donate",
"footer.mobileApp.apple": "Download the edX mobile app from the Apple App Store",
"footer.mobileApp.google": "Download the edX mobile app from Google Play",
"footer.logo.altText": "Powered by Open edX",
"footer.logo.ariaLabel": "edX Home",
"footer.ariaLabel": "Page Footer"
}
{}

View File

@@ -1,32 +1 @@
{
"footer.socialLinks.srText.facebook": "Like edX on Facebook",
"footer.socialLinks.srText.twitter": "Follow edX on Twitter",
"footer.socialLinks.srText.youtube": "Subscribe to the edX YouTube channel",
"footer.socialLinks.srText.linkedin": "Follow edX on LinkedIn",
"footer.socialLinks.srText.reddit": "Subscribe to the edX subreddit",
"footer.languageForm.select.label": "Choose Language",
"footer.languageForm.submit.label": "Apply",
"footer.edxLinks.about": "About",
"footer.edxLinks.business": "edX for Business",
"footer.edxLinks.affiliates": "Affiliates",
"footer.edxLinks.openEdx": "Open edX",
"footer.edxLinks.careers": "Careers",
"footer.edxLinks.news": "News",
"footer.legalLinks.heading": "Legal",
"footer.legalLinks.termsOfService": "Terms of Service & Honor Code",
"footer.legalLinks.privacyPolicy": "Privacy Policy",
"footer.legalLinks.a11yPolicy": "Accessibility Policy",
"footer.legalLinks.trademarkPolicy": "Trademark Policy",
"footer.legalLinks.sitemap": "Sitemap",
"footer.connectLinks.heading": "Connect",
"footer.connectLinks.blog": "Blog",
"footer.connectLinks.contact": "Contact Us",
"footer.connectLinks.help": "Help Center",
"footer.connectLinks.mediaKit": "Media Kit",
"footer.connectLinks.donate": "Donate",
"footer.mobileApp.apple": "Download the edX mobile app from the Apple App Store",
"footer.mobileApp.google": "Download the edX mobile app from Google Play",
"footer.logo.altText": "Powered by Open edX",
"footer.logo.ariaLabel": "edX Home",
"footer.ariaLabel": "Page Footer"
}
{}

View File

@@ -1,32 +1 @@
{
"footer.socialLinks.srText.facebook": "Like edX on Facebook",
"footer.socialLinks.srText.twitter": "Follow edX on Twitter",
"footer.socialLinks.srText.youtube": "Subscribe to the edX YouTube channel",
"footer.socialLinks.srText.linkedin": "Follow edX on LinkedIn",
"footer.socialLinks.srText.reddit": "Subscribe to the edX subreddit",
"footer.languageForm.select.label": "Choose Language",
"footer.languageForm.submit.label": "Apply",
"footer.edxLinks.about": "About",
"footer.edxLinks.business": "edX for Business",
"footer.edxLinks.affiliates": "Affiliates",
"footer.edxLinks.openEdx": "Open edX",
"footer.edxLinks.careers": "Careers",
"footer.edxLinks.news": "News",
"footer.legalLinks.heading": "Legal",
"footer.legalLinks.termsOfService": "Terms of Service & Honor Code",
"footer.legalLinks.privacyPolicy": "Privacy Policy",
"footer.legalLinks.a11yPolicy": "Accessibility Policy",
"footer.legalLinks.trademarkPolicy": "Trademark Policy",
"footer.legalLinks.sitemap": "Sitemap",
"footer.connectLinks.heading": "Connect",
"footer.connectLinks.blog": "Blog",
"footer.connectLinks.contact": "Contact Us",
"footer.connectLinks.help": "Help Center",
"footer.connectLinks.mediaKit": "Media Kit",
"footer.connectLinks.donate": "Donate",
"footer.mobileApp.apple": "Download the edX mobile app from the Apple App Store",
"footer.mobileApp.google": "Download the edX mobile app from Google Play",
"footer.logo.altText": "Powered by Open edX",
"footer.logo.ariaLabel": "edX Home",
"footer.ariaLabel": "Page Footer"
}
{}

View File

@@ -1,32 +1 @@
{
"footer.socialLinks.srText.facebook": "Like edX on Facebook",
"footer.socialLinks.srText.twitter": "Follow edX on Twitter",
"footer.socialLinks.srText.youtube": "Subscribe to the edX YouTube channel",
"footer.socialLinks.srText.linkedin": "Follow edX on LinkedIn",
"footer.socialLinks.srText.reddit": "Subscribe to the edX subreddit",
"footer.languageForm.select.label": "Choose Language",
"footer.languageForm.submit.label": "Apply",
"footer.edxLinks.about": "About",
"footer.edxLinks.business": "edX for Business",
"footer.edxLinks.affiliates": "Affiliates",
"footer.edxLinks.openEdx": "Open edX",
"footer.edxLinks.careers": "Careers",
"footer.edxLinks.news": "News",
"footer.legalLinks.heading": "Legal",
"footer.legalLinks.termsOfService": "Terms of Service & Honor Code",
"footer.legalLinks.privacyPolicy": "Privacy Policy",
"footer.legalLinks.a11yPolicy": "Accessibility Policy",
"footer.legalLinks.trademarkPolicy": "Trademark Policy",
"footer.legalLinks.sitemap": "Sitemap",
"footer.connectLinks.heading": "Connect",
"footer.connectLinks.blog": "Blog",
"footer.connectLinks.contact": "Contact Us",
"footer.connectLinks.help": "Help Center",
"footer.connectLinks.mediaKit": "Media Kit",
"footer.connectLinks.donate": "Donate",
"footer.mobileApp.apple": "Download the edX mobile app from the Apple App Store",
"footer.mobileApp.google": "Download the edX mobile app from Google Play",
"footer.logo.altText": "Powered by Open edX",
"footer.logo.ariaLabel": "edX Home",
"footer.ariaLabel": "Page Footer"
}
{}

View File

@@ -1,5 +0,0 @@
import Footer, { EVENT_NAMES } from './components/Footer';
import messages from './i18n/index';
export default Footer;
export { messages, EVENT_NAMES };

183
src/index.jsx Normal file
View File

@@ -0,0 +1,183 @@
import React from 'react';
import { render } from 'react-dom';
/* eslint-disable import/no-extraneous-dependencies */
import {
faFacebookSquare,
faTwitterSquare,
faYoutubeSquare,
faLinkedin,
faRedditSquare,
} from '@fortawesome/free-brands-svg-icons';
import { faLanguage } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
/* eslint-enable import/no-extraneous-dependencies */
import SiteFooter from './lib';
import './index.scss';
import FooterLogo from './edx-footer.png';
const edXLinks = [
{
title: 'About',
url: 'https://www.example.com/about-us',
},
{
title: 'edX for Business',
url: 'https://business.edx.org',
queryParams: { utm_test: 'utm_test_value' },
},
{
title: 'Affiliates',
url: 'https://www.example.com/affiliate-program',
},
{
title: 'Open edX',
url: 'https://www.example.com/open',
},
{
title: 'Careers',
url: 'https://www.example.com/careers',
},
{
title: 'News',
url: 'https://www.example.com/news-announcements',
},
];
const legalLinks = [
{
title: 'Terms of Service & Honor Code',
url: 'https://www.example.com/terms-of-service',
},
{
title: 'Privacy Policy',
url: 'https://www.example.com/privacy-policy',
},
{
title: 'Accessibility Policy',
url: 'https://www.example.com/accessibility',
},
{
title: 'Trademark Policy',
url: 'https://www.example.com/trademarks',
},
{
title: 'Sitemap',
url: 'https://www.example.com/sitemap',
},
];
const connectLinks = [
{
title: 'Blog',
url: 'https://www.example.com/blog',
},
{
title: 'Contact Us',
url: 'https://www.example.com/contact',
},
{
title: 'Help Center',
url: 'https://www.example.com/support',
},
{
title: 'Media Kit',
url: 'https://www.example.com/media-kit',
},
{
title: 'Donate',
url: 'https://www.example.com/donate',
},
];
const socialLinks = [
{
title: 'Facebook',
url: 'https://www.facebook.com',
icon: <FontAwesomeIcon icon={faFacebookSquare} className="social-icon" size="2x" />,
screenReaderText: 'Like edX on Facebook',
},
{
title: 'Twitter',
url: 'https://www.twitter.com',
icon: <FontAwesomeIcon icon={faTwitterSquare} className="social-icon" size="2x" />,
screenReaderText: 'Follow edX on Twitter',
},
{
title: 'Youtube',
url: 'https://www.youtube.com',
icon: <FontAwesomeIcon icon={faYoutubeSquare} className="social-icon" size="2x" />,
screenReaderText: 'Subscribe to the edX YouTube channel',
},
{
title: 'LinkedIn',
url: 'https://www.linkedin.com',
icon: <FontAwesomeIcon icon={faLinkedin} className="social-icon" size="2x" />,
screenReaderText: 'Follow edX on LinkedIn',
},
{
title: 'Reddit',
url: 'https://reddit.com',
icon: <FontAwesomeIcon icon={faRedditSquare} className="social-icon" size="2x" />,
screenReaderText: 'Subscribe to the edX subreddit',
},
];
const App = () => (
<SiteFooter
siteLogo={{
src: FooterLogo,
altText: 'edx Logo',
ariaLabel: 'edX Home',
}}
ariaLabel="Page Footer"
marketingSiteBaseUrl="https://www.example.com"
appleAppStore={{
url: 'https://store.apple.com',
altText: 'Download the edX mobile app from the Apple App Store',
}}
googlePlay={{
url: 'https://play.google.com',
altText: 'Download the edX mobile app from Google Play',
}}
handleAllTrackEvents={() => {}}
linkSectionOne={{
title: 'edX',
linkList: edXLinks,
}}
linkSectionTwo={{
title: 'Legal',
linkList: legalLinks,
}}
linkSectionThree={{
title: 'Connect',
linkList: connectLinks,
}}
socialLinks={socialLinks}
supportedLanguages={[
{
label: 'English',
value: 'en',
}, {
label: 'español',
value: 'es-419',
},
]}
languageForm={{
activeLanguage: 'en',
screenReaderLabel: 'Choose Language',
submitLabel: 'Apply',
icon: <FontAwesomeIcon icon={faLanguage} size="2x" className="text-primary" />,
onLanguageSelected: () => {},
}}
copyright="© 20122019 edX Inc."
trademark={(
<React.Fragment>EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | 深圳市恒宇博科技有限公司 <a href="http://www.beian.miit.gov.cn">粤ICP备17044299号-2</a></React.Fragment>
)}
/>
);
render(<App />, document.getElementById('root'));

4
src/index.scss Normal file
View File

@@ -0,0 +1,4 @@
@import "~@edx/edx-bootstrap/scss/edx/theme";
@import "~bootstrap/scss/bootstrap";
@import './lib/scss/_site-footer.scss';

View File

@@ -0,0 +1,348 @@
import React from 'react';
import renderer from 'react-test-renderer';
import { mount } from 'enzyme';
import {
faFacebookSquare,
faTwitterSquare,
faYoutubeSquare,
faLinkedin,
faRedditSquare,
} from '@fortawesome/free-brands-svg-icons';
import { faLanguage } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import FooterLogo from '../../../edx-footer.png';
import SiteFooter, { EVENT_NAMES } from './index';
const edXLinks = [
{
title: 'About',
url: 'https://www.example.com/about-us',
},
{
title: 'edX for Business',
url: 'https://business.edx.org',
queryParams: { utm_test: 'utm_test_value' },
},
{
title: 'Affiliates',
url: 'https://www.example.com/affiliate-program',
},
{
title: 'Open edX',
url: 'https://www.example.com/open',
},
{
title: 'Careers',
url: 'https://www.example.com/careers',
},
{
title: 'News',
url: 'https://www.example.com/news-announcements',
},
];
const legalLinks = [
{
title: 'Terms of Service & Honor Code',
url: 'https://www.example.com/terms-of-service',
},
{
title: 'Privacy Policy',
url: 'https://www.example.com/privacy-policy',
},
{
title: 'Accessibility Policy',
url: 'https://www.example.com/accessibility',
},
{
title: 'Trademark Policy',
url: 'https://www.example.com/trademarks',
},
{
title: 'Sitemap',
url: 'https://www.example.com/sitemap',
},
];
const connectLinks = [
{
title: 'Blog',
url: 'https://www.example.com/blog',
},
{
title: 'Contact Us',
url: 'https://www.example.com/contact',
},
{
title: 'Help Center',
url: 'https://www.example.com/support',
},
{
title: 'Media Kit',
url: 'https://www.example.com/media-kit',
},
{
title: 'Donate',
url: 'https://www.example.com/donate',
},
];
const socialLinks = [
{
title: 'Facebook',
url: 'https://www.facebook.com',
icon: <FontAwesomeIcon icon={faFacebookSquare} className="social-icon" size="2x" />,
screenReaderText: 'Like edX on Facebook',
},
{
title: 'Twitter',
url: 'https://www.twitter.com',
icon: <FontAwesomeIcon icon={faTwitterSquare} className="social-icon" size="2x" />,
screenReaderText: 'Follow edX on Twitter',
},
{
title: 'Youtube',
url: 'https://www.youtube.com',
icon: <FontAwesomeIcon icon={faYoutubeSquare} className="social-icon" size="2x" />,
screenReaderText: 'Subscribe to the edX YouTube channel',
},
{
title: 'LinkedIn',
url: 'https://www.linkedin.com',
icon: <FontAwesomeIcon icon={faLinkedin} className="social-icon" size="2x" />,
screenReaderText: 'Follow edX on LinkedIn',
},
{
title: 'Reddit',
url: 'https://reddit.com',
icon: <FontAwesomeIcon icon={faRedditSquare} className="social-icon" size="2x" />,
screenReaderText: 'Subscribe to the edX subreddit',
},
];
const supportedLanguages = [
{
label: 'English',
value: 'en',
}, {
label: 'español',
value: 'es-419',
},
];
const languageForm = {
activeLanguage: 'en',
screenReaderLabel: 'Choose Language',
submitLabel: 'Apply',
icon: <FontAwesomeIcon icon={faLanguage} size="2x" className="text-primary" />,
onLanguageSelected: () => {},
};
const completeSiteFooterComponent = mockHandleAllTrackEvents =>
(
<SiteFooter
siteLogo={{
src: FooterLogo,
altText: 'edx Logo',
ariaLabel: 'edX Home',
}}
ariaLabel="Page Footer"
marketingSiteBaseUrl="https://www.example.com"
appleAppStore={{
url: 'https://store.apple.com',
altText: 'Download the edX mobile app from the Apple App Store',
}}
googlePlay={{
url: 'https://play.google.com',
altText: 'Download the edX mobile app from Google Play',
}}
handleAllTrackEvents={mockHandleAllTrackEvents}
linkSectionOne={{
title: 'edX',
linkList: edXLinks,
}}
linkSectionTwo={{
title: 'Legal',
linkList: legalLinks,
}}
linkSectionThree={{
title: 'Connect',
linkList: connectLinks,
}}
socialLinks={socialLinks}
supportedLanguages={supportedLanguages}
languageForm={languageForm}
copyright="© 20122019 edX Inc."
trademark={(
<React.Fragment>EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | 深圳市恒宇博科技有限公司 <a href="http://www.beian.miit.gov.cn">粤ICP备17044299号-2</a></React.Fragment>
)}
/>
);
describe('<SiteFooter />', () => {
describe('renders correctly', () => {
it('renders with social and mobile links', () => {
const mockHandleAllTrackEvents = jest.fn();
const tree = renderer
.create(completeSiteFooterComponent(mockHandleAllTrackEvents))
.toJSON();
expect(tree).toMatchSnapshot();
});
it('does not render social links', () => {
const tree = renderer
.create((
<SiteFooter
siteLogo={{
src: FooterLogo,
altText: 'edx Logo',
ariaLabel: 'edX Home',
}}
ariaLabel="Page Footer"
marketingSiteBaseUrl="https://www.example.com"
appleAppStore={{
url: 'https://store.apple.com',
altText: 'Download the edX mobile app from the Apple App Store',
}}
googlePlay={{
url: 'https://play.google.com',
altText: 'Download the edX mobile app from Google Play',
}}
handleAllTrackEvents={jest.fn()}
linkSectionOne={{
title: 'edX',
linkList: edXLinks,
}}
linkSectionTwo={{
title: 'Legal',
linkList: legalLinks,
}}
linkSectionThree={{
title: 'Connect',
linkList: connectLinks,
}}
supportedLanguages={supportedLanguages}
languageForm={languageForm}
copyright="© 20122019 edX Inc."
trademark={(
<React.Fragment>EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | 深圳市恒宇博科技有限公司 <a href="http://www.beian.miit.gov.cn">粤ICP备17044299号-2</a></React.Fragment>
)}
/>
)).toJSON();
expect(tree).toMatchSnapshot();
});
it('does not render mobile links', () => {
const tree = renderer
.create((
<SiteFooter
siteLogo={{
src: FooterLogo,
altText: 'edx Logo',
ariaLabel: 'edX Home',
}}
ariaLabel="Page Footer"
marketingSiteBaseUrl="https://www.example.com"
appleAppStore={{
url: 'https://store.apple.com',
altText: 'Download the edX mobile app from the Apple App Store',
}}
googlePlay={{
url: 'https://play.google.com',
altText: 'Download the edX mobile app from Google Play',
}}
handleAllTrackEvents={jest.fn()}
linkSectionOne={{
title: 'edX',
linkList: edXLinks,
}}
linkSectionTwo={{
title: 'Legal',
linkList: legalLinks,
}}
linkSectionThree={{
title: 'Connect',
linkList: connectLinks,
}}
socialLinks={socialLinks}
supportedLanguages={supportedLanguages}
languageForm={languageForm}
copyright="© 20122019 edX Inc."
trademark={(
<React.Fragment>EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | 深圳市恒宇博科技有限公司 <a href="http://www.beian.miit.gov.cn">粤ICP备17044299号-2</a></React.Fragment>
)}
showMobileLinks={false}
/>
)).toJSON();
expect(tree).toMatchSnapshot();
});
it('does not render language selector', () => {
const tree = renderer
.create((
<SiteFooter
siteLogo={{
src: FooterLogo,
altText: 'edx Logo',
ariaLabel: 'edX Home',
}}
ariaLabel="Page Footer"
marketingSiteBaseUrl="https://www.example.com"
appleAppStore={{
url: 'https://store.apple.com',
altText: 'Download the edX mobile app from the Apple App Store',
}}
googlePlay={{
url: 'https://play.google.com',
altText: 'Download the edX mobile app from Google Play',
}}
handleAllTrackEvents={jest.fn()}
linkSectionOne={{
title: 'edX',
linkList: edXLinks,
}}
linkSectionTwo={{
title: 'Legal',
linkList: legalLinks,
}}
linkSectionThree={{
title: 'Connect',
linkList: connectLinks,
}}
socialLinks={socialLinks}
supportedLanguages={supportedLanguages}
copyright="© 20122019 edX Inc."
trademark={(
<React.Fragment>EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | 深圳市恒宇博科技有限公司 <a href="http://www.beian.miit.gov.cn">粤ICP备17044299号-2</a></React.Fragment>
)}
/>
)).toJSON();
expect(tree).toMatchSnapshot();
});
});
describe('handles analytics', () => {
it('calls handleAllTrackEvents prop when external links clicked', () => {
const mockHandleAllTrackEvents = jest.fn();
const footer = mount((completeSiteFooterComponent(mockHandleAllTrackEvents)));
const externalLinks = footer.find("a[target='_blank']");
expect(externalLinks.length).toEqual(socialLinks.length + 2);
externalLinks.forEach((externalLink) => {
const callIndex = mockHandleAllTrackEvents.mock.calls.length;
externalLink.simulate('click');
expect(mockHandleAllTrackEvents.mock.calls[callIndex]).toEqual([
EVENT_NAMES.FOOTER_LINK,
{
category: 'outbound_link',
label: externalLink.prop('href'),
},
]);
});
});
});
});

View File

@@ -0,0 +1,1503 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<SiteFooter /> renders correctly does not render language selector 1`] = `
<footer
aria-label="Page Footer"
className="footer d-flex justify-content-center border-top py-3 px-4"
role="contentinfo"
>
<div
className="max-width-1180 d-grid"
>
<div
className="area-1"
>
<a
aria-label="edX Home"
href="https://www.example.com"
>
<img
alt="edx Logo"
src="test-file-stub"
/>
</a>
</div>
<div
className="area-2"
>
<h2>
edX
</h2>
<ul
className="list-unstyled p-0 m-0"
>
<li>
<a
href="https://www.example.com/about-us"
>
About
</a>
</li>
<li>
<a
href="https://business.edx.org/?utm_test=utm_test_value"
>
edX for Business
</a>
</li>
<li>
<a
href="https://www.example.com/affiliate-program"
>
Affiliates
</a>
</li>
<li>
<a
href="https://www.example.com/open"
>
Open edX
</a>
</li>
<li>
<a
href="https://www.example.com/careers"
>
Careers
</a>
</li>
<li>
<a
href="https://www.example.com/news-announcements"
>
News
</a>
</li>
</ul>
</div>
<div
className="area-3"
>
<h2>
Legal
</h2>
<ul
className="list-unstyled p-0 m-0"
>
<li>
<a
href="https://www.example.com/terms-of-service"
>
Terms of Service & Honor Code
</a>
</li>
<li>
<a
href="https://www.example.com/privacy-policy"
>
Privacy Policy
</a>
</li>
<li>
<a
href="https://www.example.com/accessibility"
>
Accessibility Policy
</a>
</li>
<li>
<a
href="https://www.example.com/trademarks"
>
Trademark Policy
</a>
</li>
<li>
<a
href="https://www.example.com/sitemap"
>
Sitemap
</a>
</li>
</ul>
</div>
<div
className="area-4"
>
<h2>
Connect
</h2>
<ul
className="list-unstyled p-0 m-0"
>
<li>
<a
href="https://www.example.com/blog"
>
Blog
</a>
</li>
<li>
<a
href="https://www.example.com/contact"
>
Contact Us
</a>
</li>
<li>
<a
href="https://www.example.com/support"
>
Help Center
</a>
</li>
<li>
<a
href="https://www.example.com/media-kit"
>
Media Kit
</a>
</li>
<li>
<a
href="https://www.example.com/donate"
>
Donate
</a>
</li>
</ul>
</div>
<div
className="area-5"
>
<ul
className="d-flex flex-row justify-content-between list-unstyled max-width-222 p-0 mb-4"
>
<li>
<a
href="https://www.facebook.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
title="Facebook"
>
<svg
aria-hidden="true"
className="svg-inline--fa fa-facebook-square fa-w-14 fa-2x social-icon"
data-icon="facebook-square"
data-prefix="fab"
focusable="false"
role="img"
style={Object {}}
viewBox="0 0 448 512"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M448 80v352c0 26.5-21.5 48-48 48h-85.3V302.8h60.6l8.7-67.6h-69.3V192c0-19.6 5.4-32.9 33.5-32.9H384V98.7c-6.2-.8-27.4-2.7-52.2-2.7-51.6 0-87 31.5-87 89.4v49.9H184v67.6h60.9V480H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48z"
fill="currentColor"
style={Object {}}
/>
</svg>
<span
className="sr-only"
>
Like edX on Facebook
</span>
</a>
</li>
<li>
<a
href="https://www.twitter.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
title="Twitter"
>
<svg
aria-hidden="true"
className="svg-inline--fa fa-twitter-square fa-w-14 fa-2x social-icon"
data-icon="twitter-square"
data-prefix="fab"
focusable="false"
role="img"
style={Object {}}
viewBox="0 0 448 512"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-48.9 158.8c.2 2.8.2 5.7.2 8.5 0 86.7-66 186.6-186.6 186.6-37.2 0-71.7-10.8-100.7-29.4 5.3.6 10.4.8 15.8.8 30.7 0 58.9-10.4 81.4-28-28.8-.6-53-19.5-61.3-45.5 10.1 1.5 19.2 1.5 29.6-1.2-30-6.1-52.5-32.5-52.5-64.4v-.8c8.7 4.9 18.9 7.9 29.6 8.3a65.447 65.447 0 0 1-29.2-54.6c0-12.2 3.2-23.4 8.9-33.1 32.3 39.8 80.8 65.8 135.2 68.6-9.3-44.5 24-80.6 64-80.6 18.9 0 35.9 7.9 47.9 20.7 14.8-2.8 29-8.3 41.6-15.8-4.9 15.2-15.2 28-28.8 36.1 13.2-1.4 26-5.1 37.8-10.2-8.9 13.1-20.1 24.7-32.9 34z"
fill="currentColor"
style={Object {}}
/>
</svg>
<span
className="sr-only"
>
Follow edX on Twitter
</span>
</a>
</li>
<li>
<a
href="https://www.youtube.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
title="Youtube"
>
<svg
aria-hidden="true"
className="svg-inline--fa fa-youtube-square fa-w-14 fa-2x social-icon"
data-icon="youtube-square"
data-prefix="fab"
focusable="false"
role="img"
style={Object {}}
viewBox="0 0 448 512"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M186.8 202.1l95.2 54.1-95.2 54.1V202.1zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-42 176.3s0-59.6-7.6-88.2c-4.2-15.8-16.5-28.2-32.2-32.4C337.9 128 224 128 224 128s-113.9 0-142.2 7.7c-15.7 4.2-28 16.6-32.2 32.4-7.6 28.5-7.6 88.2-7.6 88.2s0 59.6 7.6 88.2c4.2 15.8 16.5 27.7 32.2 31.9C110.1 384 224 384 224 384s113.9 0 142.2-7.7c15.7-4.2 28-16.1 32.2-31.9 7.6-28.5 7.6-88.1 7.6-88.1z"
fill="currentColor"
style={Object {}}
/>
</svg>
<span
className="sr-only"
>
Subscribe to the edX YouTube channel
</span>
</a>
</li>
<li>
<a
href="https://www.linkedin.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
title="LinkedIn"
>
<svg
aria-hidden="true"
className="svg-inline--fa fa-linkedin fa-w-14 fa-2x social-icon"
data-icon="linkedin"
data-prefix="fab"
focusable="false"
role="img"
style={Object {}}
viewBox="0 0 448 512"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"
fill="currentColor"
style={Object {}}
/>
</svg>
<span
className="sr-only"
>
Follow edX on LinkedIn
</span>
</a>
</li>
<li>
<a
href="https://reddit.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
title="Reddit"
>
<svg
aria-hidden="true"
className="svg-inline--fa fa-reddit-square fa-w-14 fa-2x social-icon"
data-icon="reddit-square"
data-prefix="fab"
focusable="false"
role="img"
style={Object {}}
viewBox="0 0 448 512"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M283.2 345.5c2.7 2.7 2.7 6.8 0 9.2-24.5 24.5-93.8 24.6-118.4 0-2.7-2.4-2.7-6.5 0-9.2 2.4-2.4 6.5-2.4 8.9 0 18.7 19.2 81 19.6 100.5 0 2.4-2.3 6.6-2.3 9 0zm-91.3-53.8c0-14.9-11.9-26.8-26.5-26.8-14.9 0-26.8 11.9-26.8 26.8 0 14.6 11.9 26.5 26.8 26.5 14.6 0 26.5-11.9 26.5-26.5zm90.7-26.8c-14.6 0-26.5 11.9-26.5 26.8 0 14.6 11.9 26.5 26.5 26.5 14.9 0 26.8-11.9 26.8-26.5 0-14.9-11.9-26.8-26.8-26.8zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-99.7 140.6c-10.1 0-19 4.2-25.6 10.7-24.1-16.7-56.5-27.4-92.5-28.6l18.7-84.2 59.5 13.4c0 14.6 11.9 26.5 26.5 26.5 14.9 0 26.8-12.2 26.8-26.8 0-14.6-11.9-26.8-26.8-26.8-10.4 0-19.3 6.2-23.8 14.9l-65.7-14.6c-3.3-.9-6.5 1.5-7.4 4.8l-20.5 92.8c-35.7 1.5-67.8 12.2-91.9 28.9-6.5-6.8-15.8-11-25.9-11-37.5 0-49.8 50.4-15.5 67.5-1.2 5.4-1.8 11-1.8 16.7 0 56.5 63.7 102.3 141.9 102.3 78.5 0 142.2-45.8 142.2-102.3 0-5.7-.6-11.6-2.1-17 33.6-17.2 21.2-67.2-16.1-67.2z"
fill="currentColor"
style={Object {}}
/>
</svg>
<span
className="sr-only"
>
Subscribe to the edX subreddit
</span>
</a>
</li>
</ul>
<ul
className="d-flex flex-row justify-content-between list-unstyled max-width-264 p-0 mb-5"
>
<li>
<a
href="https://store.apple.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
>
<img
alt="Download the edX mobile app from the Apple App Store"
className="max-height-39"
src="https://prod-edxapp.edx-cdn.org/static/images/app/app_store_badge_135x40.d0558d910630.svg"
/>
</a>
</li>
<li>
<a
href="https://play.google.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
>
<img
alt="Download the edX mobile app from Google Play"
className="max-height-39"
src="https://prod-edxapp.edx-cdn.org/static/images/app/google_play_badge_45.6ea466e328da.png"
/>
</a>
</li>
</ul>
<p>
© 20122019 edX Inc.
<br />
EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | 深圳市恒宇博科技有限公司
<a
href="http://www.beian.miit.gov.cn"
>
粤ICP备17044299号-2
</a>
</p>
</div>
</div>
</footer>
`;
exports[`<SiteFooter /> renders correctly does not render mobile links 1`] = `
<footer
aria-label="Page Footer"
className="footer d-flex justify-content-center border-top py-3 px-4"
role="contentinfo"
>
<div
className="max-width-1180 d-grid"
>
<div
className="area-1"
>
<a
aria-label="edX Home"
href="https://www.example.com"
>
<img
alt="edx Logo"
src="test-file-stub"
/>
</a>
<div
className="i18n d-flex mt-2"
>
<form
className="d-flex align-items-start"
onSubmit={[Function]}
>
<label
htmlFor="site-footer-language-select"
>
<svg
aria-hidden="true"
className="svg-inline--fa fa-language fa-w-20 fa-2x text-primary"
data-icon="language"
data-prefix="fas"
focusable="false"
role="img"
style={Object {}}
viewBox="0 0 640 512"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M152.1 236.2c-3.5-12.1-7.8-33.2-7.8-33.2h-.5s-4.3 21.1-7.8 33.2l-11.1 37.5H163zM616 96H336v320h280c13.3 0 24-10.7 24-24V120c0-13.3-10.7-24-24-24zm-24 120c0 6.6-5.4 12-12 12h-11.4c-6.9 23.6-21.7 47.4-42.7 69.9 8.4 6.4 17.1 12.5 26.1 18 5.5 3.4 7.3 10.5 4.1 16.2l-7.9 13.9c-3.4 5.9-10.9 7.8-16.7 4.3-12.6-7.8-24.5-16.1-35.4-24.9-10.9 8.7-22.7 17.1-35.4 24.9-5.8 3.5-13.3 1.6-16.7-4.3l-7.9-13.9c-3.2-5.6-1.4-12.8 4.2-16.2 9.3-5.7 18-11.7 26.1-18-7.9-8.4-14.9-17-21-25.7-4-5.7-2.2-13.6 3.7-17.1l6.5-3.9 7.3-4.3c5.4-3.2 12.4-1.7 16 3.4 5 7 10.8 14 17.4 20.9 13.5-14.2 23.8-28.9 30-43.2H412c-6.6 0-12-5.4-12-12v-16c0-6.6 5.4-12 12-12h64v-16c0-6.6 5.4-12 12-12h16c6.6 0 12 5.4 12 12v16h64c6.6 0 12 5.4 12 12zM0 120v272c0 13.3 10.7 24 24 24h280V96H24c-13.3 0-24 10.7-24 24zm58.9 216.1L116.4 167c1.7-4.9 6.2-8.1 11.4-8.1h32.5c5.1 0 9.7 3.3 11.4 8.1l57.5 169.1c2.6 7.8-3.1 15.9-11.4 15.9h-22.9a12 12 0 0 1-11.5-8.6l-9.4-31.9h-60.2l-9.1 31.8c-1.5 5.1-6.2 8.7-11.5 8.7H70.3c-8.2 0-14-8.1-11.4-15.9z"
fill="currentColor"
style={Object {}}
/>
</svg>
<div
className="sr-only"
>
Choose Language
</div>
</label>
<select
className="mx-2 mt-1"
defaultValue="en"
id="site-footer-language-select"
name="site-footer-language-select"
>
<option
value="en"
>
English
</option>
<option
value="es-419"
>
español
</option>
</select>
<button
className="mt-1"
type="submit"
>
Apply
</button>
</form>
</div>
</div>
<div
className="area-2"
>
<h2>
edX
</h2>
<ul
className="list-unstyled p-0 m-0"
>
<li>
<a
href="https://www.example.com/about-us"
>
About
</a>
</li>
<li>
<a
href="https://business.edx.org/?utm_test=utm_test_value"
>
edX for Business
</a>
</li>
<li>
<a
href="https://www.example.com/affiliate-program"
>
Affiliates
</a>
</li>
<li>
<a
href="https://www.example.com/open"
>
Open edX
</a>
</li>
<li>
<a
href="https://www.example.com/careers"
>
Careers
</a>
</li>
<li>
<a
href="https://www.example.com/news-announcements"
>
News
</a>
</li>
</ul>
</div>
<div
className="area-3"
>
<h2>
Legal
</h2>
<ul
className="list-unstyled p-0 m-0"
>
<li>
<a
href="https://www.example.com/terms-of-service"
>
Terms of Service & Honor Code
</a>
</li>
<li>
<a
href="https://www.example.com/privacy-policy"
>
Privacy Policy
</a>
</li>
<li>
<a
href="https://www.example.com/accessibility"
>
Accessibility Policy
</a>
</li>
<li>
<a
href="https://www.example.com/trademarks"
>
Trademark Policy
</a>
</li>
<li>
<a
href="https://www.example.com/sitemap"
>
Sitemap
</a>
</li>
</ul>
</div>
<div
className="area-4"
>
<h2>
Connect
</h2>
<ul
className="list-unstyled p-0 m-0"
>
<li>
<a
href="https://www.example.com/blog"
>
Blog
</a>
</li>
<li>
<a
href="https://www.example.com/contact"
>
Contact Us
</a>
</li>
<li>
<a
href="https://www.example.com/support"
>
Help Center
</a>
</li>
<li>
<a
href="https://www.example.com/media-kit"
>
Media Kit
</a>
</li>
<li>
<a
href="https://www.example.com/donate"
>
Donate
</a>
</li>
</ul>
</div>
<div
className="area-5"
>
<ul
className="d-flex flex-row justify-content-between list-unstyled max-width-222 p-0 mb-4"
>
<li>
<a
href="https://www.facebook.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
title="Facebook"
>
<svg
aria-hidden="true"
className="svg-inline--fa fa-facebook-square fa-w-14 fa-2x social-icon"
data-icon="facebook-square"
data-prefix="fab"
focusable="false"
role="img"
style={Object {}}
viewBox="0 0 448 512"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M448 80v352c0 26.5-21.5 48-48 48h-85.3V302.8h60.6l8.7-67.6h-69.3V192c0-19.6 5.4-32.9 33.5-32.9H384V98.7c-6.2-.8-27.4-2.7-52.2-2.7-51.6 0-87 31.5-87 89.4v49.9H184v67.6h60.9V480H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48z"
fill="currentColor"
style={Object {}}
/>
</svg>
<span
className="sr-only"
>
Like edX on Facebook
</span>
</a>
</li>
<li>
<a
href="https://www.twitter.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
title="Twitter"
>
<svg
aria-hidden="true"
className="svg-inline--fa fa-twitter-square fa-w-14 fa-2x social-icon"
data-icon="twitter-square"
data-prefix="fab"
focusable="false"
role="img"
style={Object {}}
viewBox="0 0 448 512"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-48.9 158.8c.2 2.8.2 5.7.2 8.5 0 86.7-66 186.6-186.6 186.6-37.2 0-71.7-10.8-100.7-29.4 5.3.6 10.4.8 15.8.8 30.7 0 58.9-10.4 81.4-28-28.8-.6-53-19.5-61.3-45.5 10.1 1.5 19.2 1.5 29.6-1.2-30-6.1-52.5-32.5-52.5-64.4v-.8c8.7 4.9 18.9 7.9 29.6 8.3a65.447 65.447 0 0 1-29.2-54.6c0-12.2 3.2-23.4 8.9-33.1 32.3 39.8 80.8 65.8 135.2 68.6-9.3-44.5 24-80.6 64-80.6 18.9 0 35.9 7.9 47.9 20.7 14.8-2.8 29-8.3 41.6-15.8-4.9 15.2-15.2 28-28.8 36.1 13.2-1.4 26-5.1 37.8-10.2-8.9 13.1-20.1 24.7-32.9 34z"
fill="currentColor"
style={Object {}}
/>
</svg>
<span
className="sr-only"
>
Follow edX on Twitter
</span>
</a>
</li>
<li>
<a
href="https://www.youtube.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
title="Youtube"
>
<svg
aria-hidden="true"
className="svg-inline--fa fa-youtube-square fa-w-14 fa-2x social-icon"
data-icon="youtube-square"
data-prefix="fab"
focusable="false"
role="img"
style={Object {}}
viewBox="0 0 448 512"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M186.8 202.1l95.2 54.1-95.2 54.1V202.1zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-42 176.3s0-59.6-7.6-88.2c-4.2-15.8-16.5-28.2-32.2-32.4C337.9 128 224 128 224 128s-113.9 0-142.2 7.7c-15.7 4.2-28 16.6-32.2 32.4-7.6 28.5-7.6 88.2-7.6 88.2s0 59.6 7.6 88.2c4.2 15.8 16.5 27.7 32.2 31.9C110.1 384 224 384 224 384s113.9 0 142.2-7.7c15.7-4.2 28-16.1 32.2-31.9 7.6-28.5 7.6-88.1 7.6-88.1z"
fill="currentColor"
style={Object {}}
/>
</svg>
<span
className="sr-only"
>
Subscribe to the edX YouTube channel
</span>
</a>
</li>
<li>
<a
href="https://www.linkedin.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
title="LinkedIn"
>
<svg
aria-hidden="true"
className="svg-inline--fa fa-linkedin fa-w-14 fa-2x social-icon"
data-icon="linkedin"
data-prefix="fab"
focusable="false"
role="img"
style={Object {}}
viewBox="0 0 448 512"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"
fill="currentColor"
style={Object {}}
/>
</svg>
<span
className="sr-only"
>
Follow edX on LinkedIn
</span>
</a>
</li>
<li>
<a
href="https://reddit.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
title="Reddit"
>
<svg
aria-hidden="true"
className="svg-inline--fa fa-reddit-square fa-w-14 fa-2x social-icon"
data-icon="reddit-square"
data-prefix="fab"
focusable="false"
role="img"
style={Object {}}
viewBox="0 0 448 512"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M283.2 345.5c2.7 2.7 2.7 6.8 0 9.2-24.5 24.5-93.8 24.6-118.4 0-2.7-2.4-2.7-6.5 0-9.2 2.4-2.4 6.5-2.4 8.9 0 18.7 19.2 81 19.6 100.5 0 2.4-2.3 6.6-2.3 9 0zm-91.3-53.8c0-14.9-11.9-26.8-26.5-26.8-14.9 0-26.8 11.9-26.8 26.8 0 14.6 11.9 26.5 26.8 26.5 14.6 0 26.5-11.9 26.5-26.5zm90.7-26.8c-14.6 0-26.5 11.9-26.5 26.8 0 14.6 11.9 26.5 26.5 26.5 14.9 0 26.8-11.9 26.8-26.5 0-14.9-11.9-26.8-26.8-26.8zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-99.7 140.6c-10.1 0-19 4.2-25.6 10.7-24.1-16.7-56.5-27.4-92.5-28.6l18.7-84.2 59.5 13.4c0 14.6 11.9 26.5 26.5 26.5 14.9 0 26.8-12.2 26.8-26.8 0-14.6-11.9-26.8-26.8-26.8-10.4 0-19.3 6.2-23.8 14.9l-65.7-14.6c-3.3-.9-6.5 1.5-7.4 4.8l-20.5 92.8c-35.7 1.5-67.8 12.2-91.9 28.9-6.5-6.8-15.8-11-25.9-11-37.5 0-49.8 50.4-15.5 67.5-1.2 5.4-1.8 11-1.8 16.7 0 56.5 63.7 102.3 141.9 102.3 78.5 0 142.2-45.8 142.2-102.3 0-5.7-.6-11.6-2.1-17 33.6-17.2 21.2-67.2-16.1-67.2z"
fill="currentColor"
style={Object {}}
/>
</svg>
<span
className="sr-only"
>
Subscribe to the edX subreddit
</span>
</a>
</li>
</ul>
<p>
© 20122019 edX Inc.
<br />
EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | 深圳市恒宇博科技有限公司
<a
href="http://www.beian.miit.gov.cn"
>
粤ICP备17044299号-2
</a>
</p>
</div>
</div>
</footer>
`;
exports[`<SiteFooter /> renders correctly does not render social links 1`] = `
<footer
aria-label="Page Footer"
className="footer d-flex justify-content-center border-top py-3 px-4"
role="contentinfo"
>
<div
className="max-width-1180 d-grid"
>
<div
className="area-1"
>
<a
aria-label="edX Home"
href="https://www.example.com"
>
<img
alt="edx Logo"
src="test-file-stub"
/>
</a>
<div
className="i18n d-flex mt-2"
>
<form
className="d-flex align-items-start"
onSubmit={[Function]}
>
<label
htmlFor="site-footer-language-select"
>
<svg
aria-hidden="true"
className="svg-inline--fa fa-language fa-w-20 fa-2x text-primary"
data-icon="language"
data-prefix="fas"
focusable="false"
role="img"
style={Object {}}
viewBox="0 0 640 512"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M152.1 236.2c-3.5-12.1-7.8-33.2-7.8-33.2h-.5s-4.3 21.1-7.8 33.2l-11.1 37.5H163zM616 96H336v320h280c13.3 0 24-10.7 24-24V120c0-13.3-10.7-24-24-24zm-24 120c0 6.6-5.4 12-12 12h-11.4c-6.9 23.6-21.7 47.4-42.7 69.9 8.4 6.4 17.1 12.5 26.1 18 5.5 3.4 7.3 10.5 4.1 16.2l-7.9 13.9c-3.4 5.9-10.9 7.8-16.7 4.3-12.6-7.8-24.5-16.1-35.4-24.9-10.9 8.7-22.7 17.1-35.4 24.9-5.8 3.5-13.3 1.6-16.7-4.3l-7.9-13.9c-3.2-5.6-1.4-12.8 4.2-16.2 9.3-5.7 18-11.7 26.1-18-7.9-8.4-14.9-17-21-25.7-4-5.7-2.2-13.6 3.7-17.1l6.5-3.9 7.3-4.3c5.4-3.2 12.4-1.7 16 3.4 5 7 10.8 14 17.4 20.9 13.5-14.2 23.8-28.9 30-43.2H412c-6.6 0-12-5.4-12-12v-16c0-6.6 5.4-12 12-12h64v-16c0-6.6 5.4-12 12-12h16c6.6 0 12 5.4 12 12v16h64c6.6 0 12 5.4 12 12zM0 120v272c0 13.3 10.7 24 24 24h280V96H24c-13.3 0-24 10.7-24 24zm58.9 216.1L116.4 167c1.7-4.9 6.2-8.1 11.4-8.1h32.5c5.1 0 9.7 3.3 11.4 8.1l57.5 169.1c2.6 7.8-3.1 15.9-11.4 15.9h-22.9a12 12 0 0 1-11.5-8.6l-9.4-31.9h-60.2l-9.1 31.8c-1.5 5.1-6.2 8.7-11.5 8.7H70.3c-8.2 0-14-8.1-11.4-15.9z"
fill="currentColor"
style={Object {}}
/>
</svg>
<div
className="sr-only"
>
Choose Language
</div>
</label>
<select
className="mx-2 mt-1"
defaultValue="en"
id="site-footer-language-select"
name="site-footer-language-select"
>
<option
value="en"
>
English
</option>
<option
value="es-419"
>
español
</option>
</select>
<button
className="mt-1"
type="submit"
>
Apply
</button>
</form>
</div>
</div>
<div
className="area-2"
>
<h2>
edX
</h2>
<ul
className="list-unstyled p-0 m-0"
>
<li>
<a
href="https://www.example.com/about-us"
>
About
</a>
</li>
<li>
<a
href="https://business.edx.org/?utm_test=utm_test_value"
>
edX for Business
</a>
</li>
<li>
<a
href="https://www.example.com/affiliate-program"
>
Affiliates
</a>
</li>
<li>
<a
href="https://www.example.com/open"
>
Open edX
</a>
</li>
<li>
<a
href="https://www.example.com/careers"
>
Careers
</a>
</li>
<li>
<a
href="https://www.example.com/news-announcements"
>
News
</a>
</li>
</ul>
</div>
<div
className="area-3"
>
<h2>
Legal
</h2>
<ul
className="list-unstyled p-0 m-0"
>
<li>
<a
href="https://www.example.com/terms-of-service"
>
Terms of Service & Honor Code
</a>
</li>
<li>
<a
href="https://www.example.com/privacy-policy"
>
Privacy Policy
</a>
</li>
<li>
<a
href="https://www.example.com/accessibility"
>
Accessibility Policy
</a>
</li>
<li>
<a
href="https://www.example.com/trademarks"
>
Trademark Policy
</a>
</li>
<li>
<a
href="https://www.example.com/sitemap"
>
Sitemap
</a>
</li>
</ul>
</div>
<div
className="area-4"
>
<h2>
Connect
</h2>
<ul
className="list-unstyled p-0 m-0"
>
<li>
<a
href="https://www.example.com/blog"
>
Blog
</a>
</li>
<li>
<a
href="https://www.example.com/contact"
>
Contact Us
</a>
</li>
<li>
<a
href="https://www.example.com/support"
>
Help Center
</a>
</li>
<li>
<a
href="https://www.example.com/media-kit"
>
Media Kit
</a>
</li>
<li>
<a
href="https://www.example.com/donate"
>
Donate
</a>
</li>
</ul>
</div>
<div
className="area-5"
>
<ul
className="d-flex flex-row justify-content-between list-unstyled max-width-264 p-0 mb-5"
>
<li>
<a
href="https://store.apple.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
>
<img
alt="Download the edX mobile app from the Apple App Store"
className="max-height-39"
src="https://prod-edxapp.edx-cdn.org/static/images/app/app_store_badge_135x40.d0558d910630.svg"
/>
</a>
</li>
<li>
<a
href="https://play.google.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
>
<img
alt="Download the edX mobile app from Google Play"
className="max-height-39"
src="https://prod-edxapp.edx-cdn.org/static/images/app/google_play_badge_45.6ea466e328da.png"
/>
</a>
</li>
</ul>
<p>
© 20122019 edX Inc.
<br />
EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | 深圳市恒宇博科技有限公司
<a
href="http://www.beian.miit.gov.cn"
>
粤ICP备17044299号-2
</a>
</p>
</div>
</div>
</footer>
`;
exports[`<SiteFooter /> renders correctly renders with social and mobile links 1`] = `
<footer
aria-label="Page Footer"
className="footer d-flex justify-content-center border-top py-3 px-4"
role="contentinfo"
>
<div
className="max-width-1180 d-grid"
>
<div
className="area-1"
>
<a
aria-label="edX Home"
href="https://www.example.com"
>
<img
alt="edx Logo"
src="test-file-stub"
/>
</a>
<div
className="i18n d-flex mt-2"
>
<form
className="d-flex align-items-start"
onSubmit={[Function]}
>
<label
htmlFor="site-footer-language-select"
>
<svg
aria-hidden="true"
className="svg-inline--fa fa-language fa-w-20 fa-2x text-primary"
data-icon="language"
data-prefix="fas"
focusable="false"
role="img"
style={Object {}}
viewBox="0 0 640 512"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M152.1 236.2c-3.5-12.1-7.8-33.2-7.8-33.2h-.5s-4.3 21.1-7.8 33.2l-11.1 37.5H163zM616 96H336v320h280c13.3 0 24-10.7 24-24V120c0-13.3-10.7-24-24-24zm-24 120c0 6.6-5.4 12-12 12h-11.4c-6.9 23.6-21.7 47.4-42.7 69.9 8.4 6.4 17.1 12.5 26.1 18 5.5 3.4 7.3 10.5 4.1 16.2l-7.9 13.9c-3.4 5.9-10.9 7.8-16.7 4.3-12.6-7.8-24.5-16.1-35.4-24.9-10.9 8.7-22.7 17.1-35.4 24.9-5.8 3.5-13.3 1.6-16.7-4.3l-7.9-13.9c-3.2-5.6-1.4-12.8 4.2-16.2 9.3-5.7 18-11.7 26.1-18-7.9-8.4-14.9-17-21-25.7-4-5.7-2.2-13.6 3.7-17.1l6.5-3.9 7.3-4.3c5.4-3.2 12.4-1.7 16 3.4 5 7 10.8 14 17.4 20.9 13.5-14.2 23.8-28.9 30-43.2H412c-6.6 0-12-5.4-12-12v-16c0-6.6 5.4-12 12-12h64v-16c0-6.6 5.4-12 12-12h16c6.6 0 12 5.4 12 12v16h64c6.6 0 12 5.4 12 12zM0 120v272c0 13.3 10.7 24 24 24h280V96H24c-13.3 0-24 10.7-24 24zm58.9 216.1L116.4 167c1.7-4.9 6.2-8.1 11.4-8.1h32.5c5.1 0 9.7 3.3 11.4 8.1l57.5 169.1c2.6 7.8-3.1 15.9-11.4 15.9h-22.9a12 12 0 0 1-11.5-8.6l-9.4-31.9h-60.2l-9.1 31.8c-1.5 5.1-6.2 8.7-11.5 8.7H70.3c-8.2 0-14-8.1-11.4-15.9z"
fill="currentColor"
style={Object {}}
/>
</svg>
<div
className="sr-only"
>
Choose Language
</div>
</label>
<select
className="mx-2 mt-1"
defaultValue="en"
id="site-footer-language-select"
name="site-footer-language-select"
>
<option
value="en"
>
English
</option>
<option
value="es-419"
>
español
</option>
</select>
<button
className="mt-1"
type="submit"
>
Apply
</button>
</form>
</div>
</div>
<div
className="area-2"
>
<h2>
edX
</h2>
<ul
className="list-unstyled p-0 m-0"
>
<li>
<a
href="https://www.example.com/about-us"
>
About
</a>
</li>
<li>
<a
href="https://business.edx.org/?utm_test=utm_test_value"
>
edX for Business
</a>
</li>
<li>
<a
href="https://www.example.com/affiliate-program"
>
Affiliates
</a>
</li>
<li>
<a
href="https://www.example.com/open"
>
Open edX
</a>
</li>
<li>
<a
href="https://www.example.com/careers"
>
Careers
</a>
</li>
<li>
<a
href="https://www.example.com/news-announcements"
>
News
</a>
</li>
</ul>
</div>
<div
className="area-3"
>
<h2>
Legal
</h2>
<ul
className="list-unstyled p-0 m-0"
>
<li>
<a
href="https://www.example.com/terms-of-service"
>
Terms of Service & Honor Code
</a>
</li>
<li>
<a
href="https://www.example.com/privacy-policy"
>
Privacy Policy
</a>
</li>
<li>
<a
href="https://www.example.com/accessibility"
>
Accessibility Policy
</a>
</li>
<li>
<a
href="https://www.example.com/trademarks"
>
Trademark Policy
</a>
</li>
<li>
<a
href="https://www.example.com/sitemap"
>
Sitemap
</a>
</li>
</ul>
</div>
<div
className="area-4"
>
<h2>
Connect
</h2>
<ul
className="list-unstyled p-0 m-0"
>
<li>
<a
href="https://www.example.com/blog"
>
Blog
</a>
</li>
<li>
<a
href="https://www.example.com/contact"
>
Contact Us
</a>
</li>
<li>
<a
href="https://www.example.com/support"
>
Help Center
</a>
</li>
<li>
<a
href="https://www.example.com/media-kit"
>
Media Kit
</a>
</li>
<li>
<a
href="https://www.example.com/donate"
>
Donate
</a>
</li>
</ul>
</div>
<div
className="area-5"
>
<ul
className="d-flex flex-row justify-content-between list-unstyled max-width-222 p-0 mb-4"
>
<li>
<a
href="https://www.facebook.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
title="Facebook"
>
<svg
aria-hidden="true"
className="svg-inline--fa fa-facebook-square fa-w-14 fa-2x social-icon"
data-icon="facebook-square"
data-prefix="fab"
focusable="false"
role="img"
style={Object {}}
viewBox="0 0 448 512"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M448 80v352c0 26.5-21.5 48-48 48h-85.3V302.8h60.6l8.7-67.6h-69.3V192c0-19.6 5.4-32.9 33.5-32.9H384V98.7c-6.2-.8-27.4-2.7-52.2-2.7-51.6 0-87 31.5-87 89.4v49.9H184v67.6h60.9V480H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48z"
fill="currentColor"
style={Object {}}
/>
</svg>
<span
className="sr-only"
>
Like edX on Facebook
</span>
</a>
</li>
<li>
<a
href="https://www.twitter.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
title="Twitter"
>
<svg
aria-hidden="true"
className="svg-inline--fa fa-twitter-square fa-w-14 fa-2x social-icon"
data-icon="twitter-square"
data-prefix="fab"
focusable="false"
role="img"
style={Object {}}
viewBox="0 0 448 512"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-48.9 158.8c.2 2.8.2 5.7.2 8.5 0 86.7-66 186.6-186.6 186.6-37.2 0-71.7-10.8-100.7-29.4 5.3.6 10.4.8 15.8.8 30.7 0 58.9-10.4 81.4-28-28.8-.6-53-19.5-61.3-45.5 10.1 1.5 19.2 1.5 29.6-1.2-30-6.1-52.5-32.5-52.5-64.4v-.8c8.7 4.9 18.9 7.9 29.6 8.3a65.447 65.447 0 0 1-29.2-54.6c0-12.2 3.2-23.4 8.9-33.1 32.3 39.8 80.8 65.8 135.2 68.6-9.3-44.5 24-80.6 64-80.6 18.9 0 35.9 7.9 47.9 20.7 14.8-2.8 29-8.3 41.6-15.8-4.9 15.2-15.2 28-28.8 36.1 13.2-1.4 26-5.1 37.8-10.2-8.9 13.1-20.1 24.7-32.9 34z"
fill="currentColor"
style={Object {}}
/>
</svg>
<span
className="sr-only"
>
Follow edX on Twitter
</span>
</a>
</li>
<li>
<a
href="https://www.youtube.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
title="Youtube"
>
<svg
aria-hidden="true"
className="svg-inline--fa fa-youtube-square fa-w-14 fa-2x social-icon"
data-icon="youtube-square"
data-prefix="fab"
focusable="false"
role="img"
style={Object {}}
viewBox="0 0 448 512"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M186.8 202.1l95.2 54.1-95.2 54.1V202.1zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-42 176.3s0-59.6-7.6-88.2c-4.2-15.8-16.5-28.2-32.2-32.4C337.9 128 224 128 224 128s-113.9 0-142.2 7.7c-15.7 4.2-28 16.6-32.2 32.4-7.6 28.5-7.6 88.2-7.6 88.2s0 59.6 7.6 88.2c4.2 15.8 16.5 27.7 32.2 31.9C110.1 384 224 384 224 384s113.9 0 142.2-7.7c15.7-4.2 28-16.1 32.2-31.9 7.6-28.5 7.6-88.1 7.6-88.1z"
fill="currentColor"
style={Object {}}
/>
</svg>
<span
className="sr-only"
>
Subscribe to the edX YouTube channel
</span>
</a>
</li>
<li>
<a
href="https://www.linkedin.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
title="LinkedIn"
>
<svg
aria-hidden="true"
className="svg-inline--fa fa-linkedin fa-w-14 fa-2x social-icon"
data-icon="linkedin"
data-prefix="fab"
focusable="false"
role="img"
style={Object {}}
viewBox="0 0 448 512"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"
fill="currentColor"
style={Object {}}
/>
</svg>
<span
className="sr-only"
>
Follow edX on LinkedIn
</span>
</a>
</li>
<li>
<a
href="https://reddit.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
title="Reddit"
>
<svg
aria-hidden="true"
className="svg-inline--fa fa-reddit-square fa-w-14 fa-2x social-icon"
data-icon="reddit-square"
data-prefix="fab"
focusable="false"
role="img"
style={Object {}}
viewBox="0 0 448 512"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M283.2 345.5c2.7 2.7 2.7 6.8 0 9.2-24.5 24.5-93.8 24.6-118.4 0-2.7-2.4-2.7-6.5 0-9.2 2.4-2.4 6.5-2.4 8.9 0 18.7 19.2 81 19.6 100.5 0 2.4-2.3 6.6-2.3 9 0zm-91.3-53.8c0-14.9-11.9-26.8-26.5-26.8-14.9 0-26.8 11.9-26.8 26.8 0 14.6 11.9 26.5 26.8 26.5 14.6 0 26.5-11.9 26.5-26.5zm90.7-26.8c-14.6 0-26.5 11.9-26.5 26.8 0 14.6 11.9 26.5 26.5 26.5 14.9 0 26.8-11.9 26.8-26.5 0-14.9-11.9-26.8-26.8-26.8zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-99.7 140.6c-10.1 0-19 4.2-25.6 10.7-24.1-16.7-56.5-27.4-92.5-28.6l18.7-84.2 59.5 13.4c0 14.6 11.9 26.5 26.5 26.5 14.9 0 26.8-12.2 26.8-26.8 0-14.6-11.9-26.8-26.8-26.8-10.4 0-19.3 6.2-23.8 14.9l-65.7-14.6c-3.3-.9-6.5 1.5-7.4 4.8l-20.5 92.8c-35.7 1.5-67.8 12.2-91.9 28.9-6.5-6.8-15.8-11-25.9-11-37.5 0-49.8 50.4-15.5 67.5-1.2 5.4-1.8 11-1.8 16.7 0 56.5 63.7 102.3 141.9 102.3 78.5 0 142.2-45.8 142.2-102.3 0-5.7-.6-11.6-2.1-17 33.6-17.2 21.2-67.2-16.1-67.2z"
fill="currentColor"
style={Object {}}
/>
</svg>
<span
className="sr-only"
>
Subscribe to the edX subreddit
</span>
</a>
</li>
</ul>
<ul
className="d-flex flex-row justify-content-between list-unstyled max-width-264 p-0 mb-5"
>
<li>
<a
href="https://store.apple.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
>
<img
alt="Download the edX mobile app from the Apple App Store"
className="max-height-39"
src="https://prod-edxapp.edx-cdn.org/static/images/app/app_store_badge_135x40.d0558d910630.svg"
/>
</a>
</li>
<li>
<a
href="https://play.google.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
>
<img
alt="Download the edX mobile app from Google Play"
className="max-height-39"
src="https://prod-edxapp.edx-cdn.org/static/images/app/google_play_badge_45.6ea466e328da.png"
/>
</a>
</li>
</ul>
<p>
© 20122019 edX Inc.
<br />
EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | 深圳市恒宇博科技有限公司
<a
href="http://www.beian.miit.gov.cn"
>
粤ICP备17044299号-2
</a>
</p>
</div>
</div>
</footer>
`;

View File

@@ -0,0 +1,278 @@
import React from 'react';
import PropTypes from 'prop-types';
import qs from 'query-string';
import { Hyperlink } from '@edx/paragon';
const EVENT_NAMES = {
FOOTER_LINK: 'edx.bi.footer.link',
};
class SiteFooter extends React.Component {
constructor(props) {
super(props);
this.externalLinkClickHandler = this.externalLinkClickHandler.bind(this);
this.applyLanguageSelection = this.applyLanguageSelection.bind(this);
}
applyLanguageSelection(event) {
event.preventDefault();
const languageCode = event.target.elements['site-footer-language-select'].value;
const { languageForm: { onLanguageSelected } } = this.props;
onLanguageSelected(languageCode);
}
externalLinkClickHandler(event) {
const label = event.currentTarget.getAttribute('href');
const eventName = EVENT_NAMES.FOOTER_LINK;
const properties = {
category: 'outbound_link',
label,
};
this.props.handleAllTrackEvents(eventName, properties);
}
formatUrl(linkData) {
const {
queryParams,
url,
} = linkData;
return queryParams ? `${url}/?${qs.stringify(queryParams)}` : url;
}
renderLinkList({ title, linkList }) {
if (linkList.length > 0) {
return (
<React.Fragment>
<h2>{title}</h2>
<ul className="list-unstyled p-0 m-0">
{linkList.map(link => (
<li key={link.url}>
<Hyperlink destination={this.formatUrl(link)}>
{link.title}
</Hyperlink>
</li>
))}
</ul>
</React.Fragment>
);
}
return null;
}
renderMobileLinks() {
const {
showMobileLinks,
appleAppStore,
googlePlay,
} = this.props;
if (showMobileLinks) {
return (
<ul className="d-flex flex-row justify-content-between list-unstyled max-width-264 p-0 mb-5">
<li>
<Hyperlink
destination={appleAppStore.url}
rel="noreferrer"
target="_blank"
onClick={this.externalLinkClickHandler}
>
<img
className="max-height-39"
alt={appleAppStore.altText}
src="https://prod-edxapp.edx-cdn.org/static/images/app/app_store_badge_135x40.d0558d910630.svg"
/>
</Hyperlink>
</li>
<li>
<Hyperlink
destination={googlePlay.url}
rel="noreferrer"
target="_blank"
onClick={this.externalLinkClickHandler}
>
<img
className="max-height-39"
alt={googlePlay.altText}
src="https://prod-edxapp.edx-cdn.org/static/images/app/google_play_badge_45.6ea466e328da.png"
/>
</Hyperlink>
</li>
</ul>
);
}
return null;
}
render() {
const {
ariaLabel,
linkSectionOne,
linkSectionTwo,
linkSectionThree,
siteLogo,
socialLinks,
supportedLanguages,
languageForm,
marketingSiteBaseUrl,
copyright,
trademark,
} = this.props;
const showLanguageSelector = supportedLanguages.length > 0 &&
languageForm;
return (
<footer
role="contentinfo"
aria-label={ariaLabel}
className="footer d-flex justify-content-center border-top py-3 px-4"
>
<div className="max-width-1180 d-grid">
<div className="area-1">
<Hyperlink
destination={marketingSiteBaseUrl}
aria-label={siteLogo.ariaLabel}
>
<img src={siteLogo.src} alt={siteLogo.altText} />
</Hyperlink>
{showLanguageSelector &&
<div className="i18n d-flex mt-2">
<form
className="d-flex align-items-start"
onSubmit={this.applyLanguageSelection}
>
{/* eslint-disable-next-line jsx-a11y/label-has-for */}
<label htmlFor="site-footer-language-select">
{languageForm.icon}
<div className="sr-only">{languageForm.screenReaderLabel}</div>
</label>
<select
id="site-footer-language-select"
className="mx-2 mt-1"
name="site-footer-language-select"
defaultValue={languageForm.activeLanguage}
>
{supportedLanguages.map(({ value, label }) =>
<option key={value} value={value}>{label}</option>)}
</select>
<button className="mt-1" type="submit">{languageForm.submitLabel}</button>
</form>
</div>
}
</div>
<div className="area-2">{this.renderLinkList(linkSectionOne)}</div>
<div className="area-3">{this.renderLinkList(linkSectionTwo)}</div>
<div className="area-4">{this.renderLinkList(linkSectionThree)}</div>
<div className="area-5">
{socialLinks.length > 0 &&
<ul className="d-flex flex-row justify-content-between list-unstyled max-width-222 p-0 mb-4">
{socialLinks.map(link => (
<li key={link.url}>
<Hyperlink
destination={link.url}
title={link.title}
rel="noreferrer"
target="_blank"
onClick={this.externalLinkClickHandler}
>
{link.icon}
<span className="sr-only">{link.screenReaderText}</span>
</Hyperlink>
</li>
))}
</ul>
}
{this.renderMobileLinks()}
<p>
{copyright}
<br />
{trademark}
</p>
</div>
</div>
</footer>
);
}
}
const linkSectionShape = PropTypes.shape({
title: PropTypes.string,
linkList: PropTypes.arrayOf(PropTypes.shape({
title: PropTypes.string.isRequired,
url: PropTypes.string.isRequired,
queryParams: PropTypes.shape({}),
})),
});
SiteFooter.propTypes = {
ariaLabel: PropTypes.string.isRequired,
siteLogo: PropTypes.shape({
src: PropTypes.node,
altText: PropTypes.string,
ariaLabel: PropTypes.string,
}),
marketingSiteBaseUrl: PropTypes.string,
linkSectionOne: linkSectionShape,
linkSectionTwo: linkSectionShape,
linkSectionThree: linkSectionShape,
socialLinks: PropTypes.arrayOf(PropTypes.shape({
title: PropTypes.string.isRequired,
url: PropTypes.string.isRequired,
icon: PropTypes.element.isRequired,
screenReaderText: PropTypes.string.isRequired,
})),
showMobileLinks: PropTypes.bool,
appleAppStore: PropTypes.shape({
url: PropTypes.string,
altText: PropTypes.string,
}),
googlePlay: PropTypes.shape({
url: PropTypes.string,
altText: PropTypes.string,
}),
supportedLanguages: PropTypes.arrayOf(PropTypes.shape({
label: PropTypes.string.isRequired,
value: PropTypes.string.isRequired,
})),
languageForm: PropTypes.shape({
screenReaderLabel: PropTypes.string.isRequired,
submitLabel: PropTypes.string.isRequired,
onLanguageSelected: PropTypes.func.isRequired,
icon: PropTypes.node.isRequired,
activeLanguage: PropTypes.string,
}),
copyright: PropTypes.oneOfType([
PropTypes.string,
PropTypes.node,
]),
trademark: PropTypes.oneOfType([
PropTypes.string,
PropTypes.node,
]),
handleAllTrackEvents: PropTypes.func.isRequired,
};
const linkSectionDefault = {
title: null,
linkList: [],
};
SiteFooter.defaultProps = {
siteLogo: null,
marketingSiteBaseUrl: null,
linkSectionOne: linkSectionDefault,
linkSectionTwo: linkSectionDefault,
linkSectionThree: linkSectionDefault,
socialLinks: [],
showMobileLinks: true,
appleAppStore: null,
googlePlay: null,
supportedLanguages: [],
languageForm: null,
copyright: null,
trademark: null,
};
export default SiteFooter;
export { EVENT_NAMES };

3
src/lib/index.js Normal file
View File

@@ -0,0 +1,3 @@
import SiteFooter from './components/SiteFooter';
export default SiteFooter;

View File

@@ -0,0 +1,165 @@
.max-width-222 {
max-width: 222px;
}
.max-width-264 {
max-width: 264px;
}
.max-width-1180 {
max-width: 1180px;
}
.max-height-39 {
max-height: 39px;
}
.d-grid {
display: grid;
}
$gray-footer: #fcfcfc;
$border-1: 1px solid $gray-200;
.footer {
background-color: $gray-footer;
.area-1 {
grid-column: 1;
grid-row: 1;
border-bottom: $border-1;
padding-bottom: 1rem;
}
.area-2 {
grid-column: 1;
grid-row: 2;
border-bottom: $border-1;
padding: 1rem 0;
}
.area-3 {
grid-column: 1;
grid-row: 3;
border-bottom: $border-1;
padding: 1rem 0;
}
.area-4 {
grid-column: 1;
grid-row: 4;
border-bottom: $border-1;
padding: 1rem 0;
}
.area-5 {
grid-column: 1;
grid-row: 5;
padding: 1rem 0;
}
@media only screen and (min-width: 717px) {
.area-1 {
grid-column: 1 / span 2;
grid-row: 1;
border-bottom: none;
padding: 1rem 0;
}
.area-2 {
grid-column: 1;
grid-row: 2;
}
.area-3 {
grid-column: 1;
grid-row: 3;
}
.area-4 {
grid-column: 1;
grid-row: 4;
border-bottom: none;
}
.area-5 {
grid-column: 2;
grid-row: 2 / span 3;
border-left: $border-1;
padding-left: 1rem;
margin-left: 1rem;
}
}
@media only screen and (min-width: 870px) {
.area-1 {
grid-column: 1;
grid-row: 1 / span 3;
border-right: $border-1;
padding-right: 1rem;
margin-right: 1rem;
}
.area-2 {
grid-column: 2;
grid-row: 1;
border-bottom: none;
border-right: $border-1;
padding-right: 1rem;
margin-right: 1rem;
}
.area-3 {
grid-column: 3;
grid-row: 1;
border-bottom: none;
border-right: $border-1;
padding-right: 1rem;
margin-right: 1rem;
}
.area-4 {
grid-column: 4;
grid-row: 1;
}
.area-5 {
grid-column: 2 / span 3;
grid-row: 2;
border: none;
margin-left: 0;
padding-left: 0;
}
}
@media only screen and (min-width: 1188px) {
.area-1 {
grid-column: 1 / span 1;
grid-row: 1;
}
.area-2 {
grid-column: 2;
grid-row: 1;
}
.area-3 {
grid-column: 3;
grid-row: 1;
}
.area-4 {
grid-column: 4;
grid-row: 1;
border-right: $border-1;
padding-right: 1rem;
margin-right: 1rem;
}
.area-5 {
grid-column: 5 / span 1;
grid-row: 1;
max-width: 372px;
}
}
}

View File

@@ -1,26 +0,0 @@
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
Enzyme.configure({ adapter: new Adapter() });
// These configuration values are usually set in webpack's EnvironmentPlugin however
// Jest does not use webpack so we need to set these so for testing
process.env.ACCESS_TOKEN_COOKIE_NAME = 'edx-jwt-cookie-header-payload';
process.env.BASE_URL = 'localhost:1995';
process.env.CREDENTIALS_BASE_URL = 'http://localhost:18150';
process.env.CSRF_TOKEN_API_PATH = '/csrf/api/v1/token';
process.env.ECOMMERCE_BASE_URL = 'http://localhost:18130';
process.env.LANGUAGE_PREFERENCE_COOKIE_NAME = 'openedx-language-preference';
process.env.LMS_BASE_URL = 'http://localhost:18000';
process.env.LOGIN_URL = 'http://localhost:18000/login';
process.env.LOGOUT_URL = 'http://localhost:18000/login';
process.env.MARKETING_SITE_BASE_URL = 'http://localhost:18000';
process.env.ORDER_HISTORY_URL = 'localhost:1996/orders';
process.env.REFRESH_ACCESS_TOKEN_ENDPOINT = 'http://localhost:18000/login_refresh';
process.env.SEGMENT_KEY = 'segment_whoa';
process.env.SITE_NAME = 'edX';
process.env.USER_INFO_COOKIE_NAME = 'edx-user-info';
process.env.LOGO_URL = 'https://edx-cdn.org/v3/default/logo.svg';
process.env.LOGO_TRADEMARK_URL = 'https://edx-cdn.org/v3/default/logo-trademark.svg';
process.env.LOGO_WHITE_URL = 'https://edx-cdn.org/v3/default/logo-white.svg';
process.env.FAVICON_URL = 'https://edx-cdn.org/v3/default/favicon.ico';

4
src/tests/setupTest.js Normal file
View File

@@ -0,0 +1,4 @@
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
Enzyme.configure({ adapter: new Adapter() });

1275
stats.json Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,15 +0,0 @@
const path = require('path');
const { createConfig } = require('@edx/frontend-build');
module.exports = createConfig('webpack-dev', {
entry: path.resolve(__dirname, 'example'),
output: {
path: path.resolve(__dirname, 'example/dist'),
publicPath: '/',
},
resolve: {
alias: {
'@edx/frontend-component-footer': path.resolve(__dirname, 'src'),
},
},
});