Compare commits
43 Commits
v3.0.8
...
djoy/moder
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9667a5cee4 | ||
|
|
9df6e12174 | ||
|
|
31e255ebe9 | ||
|
|
349f83f686 | ||
|
|
e0c205ce14 | ||
|
|
81398c8cfd | ||
|
|
3fcd76b455 | ||
|
|
a8f57aa553 | ||
|
|
f32b0c8dcf | ||
|
|
fb1f5c2d50 | ||
|
|
1a51d992cd | ||
|
|
e9c28163d9 | ||
|
|
6db2d70e97 | ||
|
|
3ab4adf10b | ||
|
|
a482325eac | ||
|
|
d919d1a577 | ||
|
|
4b3a91138d | ||
|
|
7680ad3393 | ||
|
|
061b41bee8 | ||
|
|
cacae4789f | ||
|
|
adceca6b53 | ||
|
|
ab61fd35eb | ||
|
|
4d739f2962 | ||
|
|
28a6c85bc0 | ||
|
|
6125988bbd | ||
|
|
9eeccc63cb | ||
|
|
2f33c6718b | ||
|
|
89397fcfdb | ||
|
|
278b4b1473 | ||
|
|
7ff9039bb7 | ||
|
|
0cf3164901 | ||
|
|
bf8020dfac | ||
|
|
f2a13b8c8e | ||
|
|
3dd9b25d11 | ||
|
|
21d7fe04e3 | ||
|
|
46d464d515 | ||
|
|
85ed8fbff4 | ||
|
|
d6adfec189 | ||
|
|
8b1943356e | ||
|
|
5aae6e8336 | ||
|
|
ae18ad45b9 | ||
|
|
0e15bb7e55 | ||
|
|
ff664b9d3b |
30
.babelrc
30
.babelrc
@@ -1,27 +1,23 @@
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"browsers": ["last 2 versions", "ie 11"]
|
||||
}
|
||||
}],
|
||||
"babel-preset-react"
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"modules": false
|
||||
},
|
||||
],
|
||||
"@babel/preset-react"
|
||||
],
|
||||
"plugins": [
|
||||
"transform-object-rest-spread"
|
||||
["@babel/plugin-proposal-object-rest-spread", {}, "object-rest-spread"],
|
||||
["@babel/plugin-proposal-class-properties", {}, "class-properties"]
|
||||
],
|
||||
"env": {
|
||||
"test": {
|
||||
"plugins": [
|
||||
"rewire"
|
||||
]
|
||||
},
|
||||
"i18n": {
|
||||
"plugins": [
|
||||
["react-intl", {
|
||||
"messagesDir": "./temp"
|
||||
}]
|
||||
]
|
||||
"presets": [
|
||||
"@babel/preset-env",
|
||||
"@babel/preset-react"
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
"error",
|
||||
{
|
||||
"devDependencies": [
|
||||
"webpack.config.js",
|
||||
"src/tests/setupTest.js",
|
||||
"src/lib/setupTest.js",
|
||||
"**/*.test.jsx",
|
||||
"**/*.test.js"
|
||||
]
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,6 +1,6 @@
|
||||
coverage
|
||||
dist
|
||||
node_modules
|
||||
temp
|
||||
|
||||
.idea/
|
||||
/.cache
|
||||
|
||||
@@ -8,7 +8,6 @@ install:
|
||||
- npm install
|
||||
script:
|
||||
- npm run lint
|
||||
- npm run i18n_extract
|
||||
- npm run test
|
||||
- npm run build
|
||||
after_success:
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
[main]
|
||||
host = https://www.transifex.com
|
||||
|
||||
[edx-platform.frontend-component-footer]
|
||||
file_filter = src/i18n/messages/<lang>.json
|
||||
source_file = src/i18n/transifex_input.json
|
||||
source_lang = en
|
||||
type = KEYVALUEJSON
|
||||
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"restructuredtext.confPath": ""
|
||||
}
|
||||
44
Makefile
44
Makefile
@@ -1,36 +1,16 @@
|
||||
extract_translations: ## no prerequisites so we can control order of operations
|
||||
echo "We have to define this target due to tooling assumptions"
|
||||
echo "Also we have to npm install using this hook b/c there's no other place for it in the current setup"
|
||||
requirements:
|
||||
npm install
|
||||
npm run-script i18n_extract
|
||||
|
||||
i18n.extract:
|
||||
# Pulling display strings from .jsx files into .json files...
|
||||
npm run-script i18n_extract
|
||||
|
||||
i18n.concat:
|
||||
# Gathering JSON messages into one file...
|
||||
./src/i18n/i18n-concat.js ./temp/src ./src/i18n/transifex_input.json
|
||||
|
||||
detect_changed_source_translations:
|
||||
git diff --exit-code ./src/i18n/transifex_input.json
|
||||
|
||||
tx_url1 = https://www.transifex.com/api/2/project/edx-platform/resource/frontend-component-footer/translation/en/strings/
|
||||
tx_url2 = https://www.transifex.com/api/2/project/edx-platform/resource/frontend-component-footer/source/
|
||||
|
||||
# push translations to Transifex, doing magic so we can include the translator comments
|
||||
push_translations: | i18n.extract
|
||||
# Adding translator comments...
|
||||
# Fetching strings from Transifex...
|
||||
./node_modules/reactifex/bash_scripts/get_hashed_strings.sh $(tx_url1)
|
||||
# Writing out comments to file...
|
||||
./src/i18n/i18n-concat.js ./temp/src --comments
|
||||
# Adding comments to Transifex...
|
||||
./node_modules/reactifex/bash_scripts/put_comments.sh $(tx_url2)
|
||||
|
||||
# pull translations from Transifex
|
||||
pull_translations: ## must be exactly this name for edx tooling support, see ecommerce-scripts/transifex/pull.py
|
||||
tx pull -f --mode reviewed --language="ar,fr,es_419,zh_CN"
|
||||
|
||||
# This target is used by Travis.
|
||||
validate-no-uncommitted-package-lock-changes:
|
||||
# Checking for package-lock.json changes...
|
||||
git diff --exit-code package-lock.json
|
||||
|
||||
build:
|
||||
rm -rf ./dist
|
||||
./node_modules/.bin/babel src --out-dir dist --source-maps --ignore **/*.test.jsx,**/*.stories.jsx,**/__mocks__,**/__snapshots__,**/setupTest.js --copy-files
|
||||
rm -rf ./dist/example
|
||||
rm -rf dist/**/*.test.jsx
|
||||
rm -rf dist/**/__snapshots__
|
||||
rm -rf dist/**/__mocks__
|
||||
rm -rf dist/lib/setupTest.js
|
||||
|
||||
12
README.rst
12
README.rst
@@ -4,10 +4,7 @@ frontend-component-footer
|
||||
|Build Status| |Coveralls| |npm_version| |npm_downloads| |license|
|
||||
|semantic-release|
|
||||
|
||||
frontend-component-footer is a library containing a site footer
|
||||
component for use when building edX frontend applications.
|
||||
|
||||
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``.
|
||||
frontend-component-footer is a library containing a site footer component for use when building edX frontend applications.
|
||||
|
||||
Usage
|
||||
-----
|
||||
@@ -17,13 +14,10 @@ To install frontend-component-footer into your project::
|
||||
npm i --save @edx/frontend-component-footer
|
||||
|
||||
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
|
||||
linked in the footer. See the sample app in `src/example/index.jsx <src/example/index.jsx>`__ for an example
|
||||
of how the SiteFooter component can be specified.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
This component uses ``react-intl``. Any containing app must provide ``react-intl`` 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>`__.
|
||||
The distribution
|
||||
|
||||
Development
|
||||
-----------
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
// 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'],
|
||||
},
|
||||
};
|
||||
@@ -1,115 +0,0 @@
|
||||
// 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');
|
||||
const path = require('path');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const webpack = require('webpack');
|
||||
|
||||
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,
|
||||
},
|
||||
});
|
||||
@@ -1,59 +0,0 @@
|
||||
// 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');
|
||||
const commonConfig = require('./webpack.common.config.js');
|
||||
const path = require('path');
|
||||
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
||||
|
||||
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',
|
||||
},
|
||||
},
|
||||
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' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
23867
package-lock.json
generated
23867
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
136
package.json
136
package.json
@@ -2,26 +2,24 @@
|
||||
"name": "@edx/frontend-component-footer",
|
||||
"version": "1.0.0-semantically-released",
|
||||
"description": "Site footer component for use when building edX frontend applications",
|
||||
"main": "dist/main.js",
|
||||
"module": "dist/main.js",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.js",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "NODE_ENV=production BABEL_ENV=production webpack --config=config/webpack.prod.config.js",
|
||||
"build": "make build",
|
||||
"gc": "commit",
|
||||
"commitmsg": "commitlint -e $GIT_PARAMS",
|
||||
"coveralls": "cat ./coverage/lcov.info | coveralls",
|
||||
"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",
|
||||
"start": "./node_modules/.bin/parcel src/example/index.html",
|
||||
"test": "jest --coverage",
|
||||
"snapshot": "jest --updateSnapshot",
|
||||
"travis-deploy-once": "travis-deploy-once",
|
||||
"watch": "watch 'npm run build' ./src"
|
||||
"travis-deploy-once": "travis-deploy-once"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -34,84 +32,66 @@
|
||||
},
|
||||
"homepage": "https://github.com/edx/frontend-component-footer#readme",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.4.4",
|
||||
"@babel/core": "^7.4.5",
|
||||
"@babel/plugin-proposal-class-properties": "^7.4.4",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.4.4",
|
||||
"@babel/preset-env": "^7.4.5",
|
||||
"@babel/preset-react": "^7.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/paragon": "^3.8.0",
|
||||
"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",
|
||||
"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.5.10",
|
||||
"react": "^16.4.2",
|
||||
"react-dev-utils": "^5.0.0",
|
||||
"react-dom": "^16.2.0",
|
||||
"react-intl": "^2.8.0",
|
||||
"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"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@edx/paragon": "^3.8.0",
|
||||
"clean-webpack-plugin": "^0.1.19",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
"prop-types": "^15.5.10",
|
||||
"react": "^16.4.2",
|
||||
"react-dom": "^16.2.0",
|
||||
"react-intl": "2.x",
|
||||
"webpack": "^4.19.1",
|
||||
"webpack-merge": "^4.2.1"
|
||||
},
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@edx/frontend-i18n": "^3.0.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"
|
||||
"@fortawesome/react-fontawesome": "^0.1.4",
|
||||
"babel-jest": "^24.8.0",
|
||||
"coveralls": "^3.0.0",
|
||||
"enzyme": "^3.3.0",
|
||||
"enzyme-adapter-react-16": "^1.1.1",
|
||||
"eslint": "^6.0.1",
|
||||
"eslint-config-edx": "^4.0.4",
|
||||
"eslint-plugin-jsx-a11y": "^6.1.2",
|
||||
"glob": "^7.1.3",
|
||||
"husky": "^0.14.3",
|
||||
"jest": "^24.8.0",
|
||||
"parcel-bundler": "^1.12.3",
|
||||
"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": "^1.22.1",
|
||||
"semantic-release": "^15.1.7",
|
||||
"travis-deploy-once": "^5.0.0"
|
||||
},
|
||||
"sass": {
|
||||
"includePaths": [
|
||||
"./node_modules"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@edx/paragon": "^6.0.2",
|
||||
"lodash.pick": "^4.4.0",
|
||||
"query-string": "^5.1.1"
|
||||
},
|
||||
"jest": {
|
||||
"setupFiles": [
|
||||
"./src/lib/setupTest.js"
|
||||
],
|
||||
"collectCoverageFrom": [
|
||||
"src/lib/**/*.{js,jsx}",
|
||||
"!src/lib/setupTest.js",
|
||||
"!src/lib/index.js",
|
||||
"!**/node_modules/**"
|
||||
],
|
||||
"moduleNameMapper": {
|
||||
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/lib/__mocks__/fileMock.js",
|
||||
"\\.(css|scss)$": "identity-obj-proxy"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
192
src/config/index.jsx
Normal file
192
src/config/index.jsx
Normal file
@@ -0,0 +1,192 @@
|
||||
/* eslint-disable */
|
||||
|
||||
import React from 'react';
|
||||
import pick from 'lodash.pick';
|
||||
|
||||
import FooterLogo from './edx-footer.png';
|
||||
|
||||
/* TODO: This file is incomplete/non-functional. It needs some thougth about how to get
|
||||
* messages/intl into it so that we can localize our titles here. I think the right answer is
|
||||
* for this file to directly import messages.js (next door) and be passed the app's `intl`
|
||||
* object, as shown below. Then it can call formatMessage on `intl`. Also, the JSX below
|
||||
* should be evaluated with the IntlProvider when it's actually rendered by the footer, so
|
||||
* that _should_ work.
|
||||
*/
|
||||
|
||||
|
||||
let config = {
|
||||
MARKETING_SITE_BASE_URL: null,
|
||||
};
|
||||
|
||||
let intl = null;
|
||||
|
||||
function validateConfiguration(newConfig) {
|
||||
Object.keys(config).forEach((key) => {
|
||||
if (newConfig[key] === undefined) {
|
||||
throw new Error(`Footer configuration error: ${key} is required.`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export function getDefaultConfiguration(newConfig, newIntl) {
|
||||
validateConfiguration(newConfig);
|
||||
config = pick(newConfig, Object.keys(config));
|
||||
intl = newIntl;
|
||||
|
||||
const edXLinks = [
|
||||
{
|
||||
title: 'About',
|
||||
url: `${config.MARKETING_SITE_BASE_URL}/about-us`,
|
||||
},
|
||||
{
|
||||
title: 'edX for Business',
|
||||
url: config.ENTERPRISE_MARKETING_URL,
|
||||
queryParams: {
|
||||
utm_campaign: config.ENTERPRISE_MARKETING_UTM_CAMPAIGN,
|
||||
utm_medium: config.ENTERPRISE_MARKETING_FOOTER_UTM_MEDIUM,
|
||||
utm_source: config.ENTERPRISE_MARKETING_UTM_SOURCE,
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Affiliates',
|
||||
url: `${config.MARKETING_SITE_BASE_URL}/affiliate-program`,
|
||||
},
|
||||
{
|
||||
title: 'Open edX',
|
||||
url: `${config.OPEN_SOURCE_URL}`,
|
||||
},
|
||||
{
|
||||
title: 'Careers',
|
||||
url: `${config.MARKETING_SITE_BASE_URL}/careers`,
|
||||
},
|
||||
{
|
||||
title: 'News',
|
||||
url: `${config.MARKETING_SITE_BASE_URL}/news-announcements`,
|
||||
},
|
||||
];
|
||||
|
||||
const legalLinks = [
|
||||
{
|
||||
title: 'Terms of Service & Honor Code',
|
||||
url: `${config.MARKETING_SITE_BASE_URL}/edx-terms-service`,
|
||||
},
|
||||
{
|
||||
title: 'Privacy Policy',
|
||||
url: `${config.MARKETING_SITE_BASE_URL}/edx-privacy-policy`,
|
||||
},
|
||||
{
|
||||
title: 'Accessibility Policy',
|
||||
url: `${config.MARKETING_SITE_BASE_URL}/accessibility`,
|
||||
},
|
||||
{
|
||||
title: 'Trademark Policy',
|
||||
url: `${config.MARKETING_SITE_BASE_URL}/trademarks`,
|
||||
},
|
||||
{
|
||||
title: 'Sitemap',
|
||||
url: `${config.MARKETING_SITE_BASE_URL}/sitemap`,
|
||||
},
|
||||
];
|
||||
|
||||
const connectLinks = [
|
||||
{
|
||||
title: 'Blog',
|
||||
url: `${config.MARKETING_SITE_BASE_URL}/blog`,
|
||||
},
|
||||
{
|
||||
title: 'Contact Us',
|
||||
url: `${config.LMS_BASE_URL}/support/contact_us`,
|
||||
},
|
||||
{
|
||||
title: 'Help Center',
|
||||
url: config.SUPPORT_URL,
|
||||
},
|
||||
{
|
||||
title: 'Media Kit',
|
||||
url: `${config.MARKETING_SITE_BASE_URL}/media-kit`,
|
||||
},
|
||||
{
|
||||
title: 'Donate',
|
||||
url: `${config.MARKETING_SITE_BASE_URL}/donate`,
|
||||
},
|
||||
];
|
||||
|
||||
const socialLinks = [
|
||||
{
|
||||
title: 'Facebook',
|
||||
url: config.FACEBOOK_URL,
|
||||
icon: <FontAwesomeIcon icon={faFacebookSquare} className="social-icon" size="2x" />,
|
||||
screenReaderText: 'Like edX on Facebook',
|
||||
},
|
||||
{
|
||||
title: 'Twitter',
|
||||
url: config.TWITTER_URL,
|
||||
icon: <FontAwesomeIcon icon={faTwitterSquare} className="social-icon" size="2x" />,
|
||||
screenReaderText: 'Follow edX on Twitter',
|
||||
},
|
||||
{
|
||||
title: 'Youtube',
|
||||
url: config.YOU_TUBE_URL,
|
||||
icon: <FontAwesomeIcon icon={faYoutubeSquare} className="social-icon" size="2x" />,
|
||||
screenReaderText: 'Subscribe to the edX YouTube channel',
|
||||
},
|
||||
{
|
||||
title: 'LinkedIn',
|
||||
url: config.LINKED_IN_URL,
|
||||
icon: <FontAwesomeIcon icon={faLinkedin} className="social-icon" size="2x" />,
|
||||
screenReaderText: 'Follow edX on LinkedIn',
|
||||
},
|
||||
{
|
||||
title: 'Reddit',
|
||||
url: config.REDDIT_URL,
|
||||
icon: <FontAwesomeIcon icon={faRedditSquare} className="social-icon" size="2x" />,
|
||||
screenReaderText: 'Subscribe to the edX subreddit',
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
const copyright = <FormattedMessage
|
||||
id="footer.site-footer.copyright-text"
|
||||
defaultMessage="{copyrightSymbol} {startDate}–{endDate} {siteName} Inc."
|
||||
values={{
|
||||
copyrightSymbol: '©',
|
||||
startDate: '2012',
|
||||
endDate: `${new Date().getFullYear()}`,
|
||||
siteName,
|
||||
}}
|
||||
description="Footer copyright text with copyright symbol and dates"
|
||||
/>
|
||||
|
||||
const trademark = <FormattedMessage
|
||||
id="footer.site-footer.trademark-text"
|
||||
defaultMessage="EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | 深圳市恒宇博科技有限公司 {icpLicense}"
|
||||
values={{ icpLicense: <a href="http://www.beian.miit.gov.cn">粤ICP备17044299号-2</a> }}
|
||||
description="Footer trademark text"
|
||||
/>
|
||||
|
||||
return {
|
||||
ariaLabel: "Page Footer",
|
||||
siteLogo: FooterLogo,
|
||||
marketingSiteBaseUrl: config.MARKETING_SITE_BASE_URL,
|
||||
linkSectionOne: edXLinks,
|
||||
linkSectionTwo: legalLinks,
|
||||
linkSectionThree: connectLinks,
|
||||
socialLinks,
|
||||
showMobileLinks: true,
|
||||
appleAppStore: {
|
||||
url: config.APPLE_APP_STORE_URL,
|
||||
altText: "Download the edX mobile app from the Apple App Store",
|
||||
},
|
||||
googlePlayUrl: {
|
||||
url: config.GOOGLE_PLAY_URL,
|
||||
altText: "Download the edX mobile app from Google Play",
|
||||
},
|
||||
supportedLanguages: [],
|
||||
languageForm: null,
|
||||
copyright,
|
||||
trademark,
|
||||
}
|
||||
};
|
||||
|
||||
export default getDefaultConfiguration;
|
||||
@@ -1,4 +1,4 @@
|
||||
import { defineMessages } from 'react-intl';
|
||||
import { defineMessages } from '@edx/frontend-i18n';
|
||||
|
||||
const messages = defineMessages({
|
||||
'footer.site-footer.site-logo.alt-text': {
|
||||
@@ -88,4 +88,4 @@ const messages = defineMessages({
|
||||
},
|
||||
});
|
||||
|
||||
export default messages;
|
||||
export default messages;
|
||||
@@ -1,11 +1,12 @@
|
||||
<!doctype html>
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<title>Footer | edX</title>
|
||||
<title>Example Footer</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>
|
||||
<script src="./index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
183
src/example/index.js
Normal file
183
src/example/index.js
Normal 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 '../config/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="© 2012–2019 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'));
|
||||
2
src/example/index.scss
Normal file
2
src/example/index.scss
Normal file
@@ -0,0 +1,2 @@
|
||||
@import "~@edx/paragon/scss/edx/theme";
|
||||
@import '../lib/SiteFooter.scss';
|
||||
@@ -1,65 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* See the Makefile for how the required hash file is downloaded from Transifex.
|
||||
*/
|
||||
|
||||
// NOTE: This script is called from Jenkins using devDependencies, so eslint is being
|
||||
// disabled so it doesn't force you to make these real dependencies.
|
||||
const fs = require('fs'); // eslint-disable-line import/no-extraneous-dependencies
|
||||
const glob = require('glob'); // eslint-disable-line import/no-extraneous-dependencies
|
||||
const path = require('path'); // eslint-disable-line import/no-extraneous-dependencies
|
||||
|
||||
// Expected input: a directory, possibly containing subdirectories, with .json files. Each .json
|
||||
// file is an array of translation triplets (id, description, defaultMessage).
|
||||
function gatherJson(dir) {
|
||||
const ret = [];
|
||||
const files = glob.sync(`${dir}/**/*.json`);
|
||||
|
||||
files.forEach((filename) => {
|
||||
const messages = JSON.parse(fs.readFileSync(filename));
|
||||
ret.push(...messages);
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
// the hash file returns ids whose periods are "escaped" (sort of), like this:
|
||||
// "key": "profile\\.sociallinks\\.social\\.links"
|
||||
// so our regular messageIds won't match them out of the box
|
||||
function escapeDots(messageId) {
|
||||
return messageId.replace(/\./g, '\\.');
|
||||
}
|
||||
|
||||
const jsonDir = process.argv[2];
|
||||
const messageObjects = gatherJson(jsonDir);
|
||||
|
||||
if (process.argv[3] === '--comments') { // prepare to handle the translator notes
|
||||
const loggingPrefix = path.basename(`${__filename}`); // the name of this JS file
|
||||
const bashScriptsPath = './node_modules/reactifex/bash_scripts';
|
||||
|
||||
const hashFile = `${bashScriptsPath}/hashmap.json`;
|
||||
process.stdout.write(`${loggingPrefix}: reading hash file ${hashFile}\n`);
|
||||
const messageInfo = JSON.parse(fs.readFileSync(hashFile));
|
||||
|
||||
const outputFile = `${bashScriptsPath}/hashed_data.txt`;
|
||||
process.stdout.write(`${loggingPrefix}: writing to output file ${outputFile}\n`);
|
||||
fs.writeFileSync(outputFile, '');
|
||||
|
||||
messageObjects.forEach((message) => {
|
||||
const transifexFormatId = escapeDots(message.id);
|
||||
|
||||
const info = messageInfo.find(mi => mi.key === transifexFormatId);
|
||||
if (info) {
|
||||
fs.appendFileSync(outputFile, `${info.string_hash}|${message.description}\n`);
|
||||
} else {
|
||||
process.stdout.write(`${loggingPrefix}: string ${message.id} does not yet exist on transifex!\n`);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
const output = {};
|
||||
|
||||
messageObjects.forEach((message) => {
|
||||
output[message.id] = message.defaultMessage;
|
||||
});
|
||||
fs.writeFileSync(process.argv[3], JSON.stringify(output, null, 2));
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
{
|
||||
"footer.site-footer.link.about": "About",
|
||||
"footer.site-footer.link.business": "{siteName} for Business",
|
||||
"footer.site-footer.link.affiliates": "Affiliates",
|
||||
"footer.site-footer.link.open-source": "Open {siteName}",
|
||||
"footer.site-footer.link.careers": "Careers",
|
||||
"footer.site-footer.link.news": "News",
|
||||
"footer.site-footer.link.header.legal": "Legal",
|
||||
"footer.site-footer.link.terms-of-service": "Terms of Service & Honor Code",
|
||||
"footer.site-footer.link.privacy": "Privacy Policy",
|
||||
"footer.site-footer.link.accessibility": "Accessibility Policy",
|
||||
"footer.site-footer.link.trademark": "Trademark Policy",
|
||||
"footer.site-footer.link.sitemap": "Sitemap",
|
||||
"footer.site-footer.link.header.connect": "Connect",
|
||||
"footer.site-footer.link.blog": "Blog",
|
||||
"footer.site-footer.link.contact-us": "Contact Us",
|
||||
"footer.site-footer.link.help-center": "Help Center",
|
||||
"footer.site-footer.link.media-kit": "Media Kit",
|
||||
"footer.site-footer.link.donate": "Donate",
|
||||
"footer.site-footer.copyright-text": "{copyrightSymbol} {startDate}–{endDate} {siteName} Inc.",
|
||||
"footer.site-footer.trademark-text": "EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | {icpLicense}",
|
||||
"footer.site-footer.site-logo.alt-text": "{siteName} logo",
|
||||
"footer.site-footer.site-logo.aria-label": "{siteName} Home",
|
||||
"footer.site-footer.facebook.title": "Facebook",
|
||||
"footer.site-footer.facebook.screen-reader-text": "Like {siteName} on Facebook",
|
||||
"footer.site-footer.twitter.title": "Twitter",
|
||||
"footer.site-footer.twitter.screen-reader-text": "Follow {siteName} on Twitter",
|
||||
"footer.site-footer.youtube.title": "Youtube",
|
||||
"footer.site-footer.youtube.screen-reader-text": "Subscribe to the {siteName} YouTube channel",
|
||||
"footer.site-footer.linkedin.title": "LinkedIn",
|
||||
"footer.site-footer.linkedin.screen-reader-text": "Follow {siteName} on LinkedIn",
|
||||
"footer.site-footer.google-plus.title": "Google+",
|
||||
"footer.site-footer.google-plus.screen-reader-text": "Follow {siteName} on Google+",
|
||||
"footer.site-footer.reddit.title": "Reddit",
|
||||
"footer.site-footer.reddit.screen-reader-text": "Subscribe to the {siteName} subreddit",
|
||||
"footer.site-footer.apple-app-store.alt-text": "Download the {siteName} mobile app from the Apple App Store",
|
||||
"footer.site-footer.google-play.alt-text": "Download the {siteName} mobile app from Google Play",
|
||||
"footer.site-footer.footer.aria-label": "Page Footer"
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
{
|
||||
"footer.site-footer.link.about": "About",
|
||||
"footer.site-footer.link.business": "{siteName} for Business",
|
||||
"footer.site-footer.link.affiliates": "Affiliates",
|
||||
"footer.site-footer.link.open-source": "Open {siteName}",
|
||||
"footer.site-footer.link.careers": "Careers",
|
||||
"footer.site-footer.link.news": "News",
|
||||
"footer.site-footer.link.header.legal": "Legal",
|
||||
"footer.site-footer.link.terms-of-service": "Terms of Service & Honor Code",
|
||||
"footer.site-footer.link.privacy": "Privacy Policy",
|
||||
"footer.site-footer.link.accessibility": "Accessibility Policy",
|
||||
"footer.site-footer.link.trademark": "Trademark Policy",
|
||||
"footer.site-footer.link.sitemap": "Sitemap",
|
||||
"footer.site-footer.link.header.connect": "Connect",
|
||||
"footer.site-footer.link.blog": "Blog",
|
||||
"footer.site-footer.link.contact-us": "Contact Us",
|
||||
"footer.site-footer.link.help-center": "Help Center",
|
||||
"footer.site-footer.link.media-kit": "Media Kit",
|
||||
"footer.site-footer.link.donate": "Donate",
|
||||
"footer.site-footer.copyright-text": "{copyrightSymbol} {startDate}–{endDate} {siteName} Inc.",
|
||||
"footer.site-footer.trademark-text": "EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | {icpLicense}",
|
||||
"footer.site-footer.site-logo.alt-text": "{siteName} logo",
|
||||
"footer.site-footer.site-logo.aria-label": "{siteName} Home",
|
||||
"footer.site-footer.facebook.title": "Facebook",
|
||||
"footer.site-footer.facebook.screen-reader-text": "Like {siteName} on Facebook",
|
||||
"footer.site-footer.twitter.title": "Twitter",
|
||||
"footer.site-footer.twitter.screen-reader-text": "Follow {siteName} on Twitter",
|
||||
"footer.site-footer.youtube.title": "Youtube",
|
||||
"footer.site-footer.youtube.screen-reader-text": "Subscribe to the {siteName} YouTube channel",
|
||||
"footer.site-footer.linkedin.title": "LinkedIn",
|
||||
"footer.site-footer.linkedin.screen-reader-text": "Follow {siteName} on LinkedIn",
|
||||
"footer.site-footer.google-plus.title": "Google+",
|
||||
"footer.site-footer.google-plus.screen-reader-text": "Follow {siteName} on Google+",
|
||||
"footer.site-footer.reddit.title": "Reddit",
|
||||
"footer.site-footer.reddit.screen-reader-text": "Subscribe to the {siteName} subreddit",
|
||||
"footer.site-footer.apple-app-store.alt-text": "Download the {siteName} mobile app from the Apple App Store",
|
||||
"footer.site-footer.google-play.alt-text": "Download the {siteName} mobile app from Google Play",
|
||||
"footer.site-footer.footer.aria-label": "Page Footer"
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
{
|
||||
"footer.site-footer.link.about": "About",
|
||||
"footer.site-footer.link.business": "{siteName} for Business",
|
||||
"footer.site-footer.link.affiliates": "Affiliates",
|
||||
"footer.site-footer.link.open-source": "Open {siteName}",
|
||||
"footer.site-footer.link.careers": "Careers",
|
||||
"footer.site-footer.link.news": "News",
|
||||
"footer.site-footer.link.header.legal": "Legal",
|
||||
"footer.site-footer.link.terms-of-service": "Terms of Service & Honor Code",
|
||||
"footer.site-footer.link.privacy": "Privacy Policy",
|
||||
"footer.site-footer.link.accessibility": "Accessibility Policy",
|
||||
"footer.site-footer.link.trademark": "Trademark Policy",
|
||||
"footer.site-footer.link.sitemap": "Sitemap",
|
||||
"footer.site-footer.link.header.connect": "Connect",
|
||||
"footer.site-footer.link.blog": "Blog",
|
||||
"footer.site-footer.link.contact-us": "Contact Us",
|
||||
"footer.site-footer.link.help-center": "Help Center",
|
||||
"footer.site-footer.link.media-kit": "Media Kit",
|
||||
"footer.site-footer.link.donate": "Donate",
|
||||
"footer.site-footer.copyright-text": "{copyrightSymbol} {startDate}–{endDate} {siteName} Inc.",
|
||||
"footer.site-footer.trademark-text": "EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | {icpLicense}",
|
||||
"footer.site-footer.site-logo.alt-text": "{siteName} logo",
|
||||
"footer.site-footer.site-logo.aria-label": "{siteName} Home",
|
||||
"footer.site-footer.facebook.title": "Facebook",
|
||||
"footer.site-footer.facebook.screen-reader-text": "Like {siteName} on Facebook",
|
||||
"footer.site-footer.twitter.title": "Twitter",
|
||||
"footer.site-footer.twitter.screen-reader-text": "Follow {siteName} on Twitter",
|
||||
"footer.site-footer.youtube.title": "Youtube",
|
||||
"footer.site-footer.youtube.screen-reader-text": "Subscribe to the {siteName} YouTube channel",
|
||||
"footer.site-footer.linkedin.title": "LinkedIn",
|
||||
"footer.site-footer.linkedin.screen-reader-text": "Follow {siteName} on LinkedIn",
|
||||
"footer.site-footer.google-plus.title": "Google+",
|
||||
"footer.site-footer.google-plus.screen-reader-text": "Follow {siteName} on Google+",
|
||||
"footer.site-footer.reddit.title": "Reddit",
|
||||
"footer.site-footer.reddit.screen-reader-text": "Subscribe to the {siteName} subreddit",
|
||||
"footer.site-footer.apple-app-store.alt-text": "Download the {siteName} mobile app from the Apple App Store",
|
||||
"footer.site-footer.google-play.alt-text": "Download the {siteName} mobile app from Google Play",
|
||||
"footer.site-footer.footer.aria-label": "Page Footer"
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
{
|
||||
"footer.site-footer.link.about": "About",
|
||||
"footer.site-footer.link.business": "{siteName} for Business",
|
||||
"footer.site-footer.link.affiliates": "Affiliates",
|
||||
"footer.site-footer.link.open-source": "Open {siteName}",
|
||||
"footer.site-footer.link.careers": "Careers",
|
||||
"footer.site-footer.link.news": "News",
|
||||
"footer.site-footer.link.header.legal": "Legal",
|
||||
"footer.site-footer.link.terms-of-service": "Terms of Service & Honor Code",
|
||||
"footer.site-footer.link.privacy": "Privacy Policy",
|
||||
"footer.site-footer.link.accessibility": "Accessibility Policy",
|
||||
"footer.site-footer.link.trademark": "Trademark Policy",
|
||||
"footer.site-footer.link.sitemap": "Sitemap",
|
||||
"footer.site-footer.link.header.connect": "Connect",
|
||||
"footer.site-footer.link.blog": "Blog",
|
||||
"footer.site-footer.link.contact-us": "Contact Us",
|
||||
"footer.site-footer.link.help-center": "Help Center",
|
||||
"footer.site-footer.link.media-kit": "Media Kit",
|
||||
"footer.site-footer.link.donate": "Donate",
|
||||
"footer.site-footer.copyright-text": "{copyrightSymbol} {startDate}–{endDate} {siteName} Inc.",
|
||||
"footer.site-footer.trademark-text": "EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | {icpLicense}",
|
||||
"footer.site-footer.site-logo.alt-text": "{siteName} logo",
|
||||
"footer.site-footer.site-logo.aria-label": "{siteName} Home",
|
||||
"footer.site-footer.facebook.title": "Facebook",
|
||||
"footer.site-footer.facebook.screen-reader-text": "Like {siteName} on Facebook",
|
||||
"footer.site-footer.twitter.title": "Twitter",
|
||||
"footer.site-footer.twitter.screen-reader-text": "Follow {siteName} on Twitter",
|
||||
"footer.site-footer.youtube.title": "Youtube",
|
||||
"footer.site-footer.youtube.screen-reader-text": "Subscribe to the {siteName} YouTube channel",
|
||||
"footer.site-footer.linkedin.title": "LinkedIn",
|
||||
"footer.site-footer.linkedin.screen-reader-text": "Follow {siteName} on LinkedIn",
|
||||
"footer.site-footer.google-plus.title": "Google+",
|
||||
"footer.site-footer.google-plus.screen-reader-text": "Follow {siteName} on Google+",
|
||||
"footer.site-footer.reddit.title": "Reddit",
|
||||
"footer.site-footer.reddit.screen-reader-text": "Subscribe to the {siteName} subreddit",
|
||||
"footer.site-footer.apple-app-store.alt-text": "Download the {siteName} mobile app from the Apple App Store",
|
||||
"footer.site-footer.google-play.alt-text": "Download the {siteName} mobile app from Google Play",
|
||||
"footer.site-footer.footer.aria-label": "Page Footer"
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
{
|
||||
"footer.site-footer.link.about": "About",
|
||||
"footer.site-footer.link.business": "{siteName} for Business",
|
||||
"footer.site-footer.link.affiliates": "Affiliates",
|
||||
"footer.site-footer.link.open-source": "Open {siteName}",
|
||||
"footer.site-footer.link.careers": "Careers",
|
||||
"footer.site-footer.link.news": "News",
|
||||
"footer.site-footer.link.header.legal": "Legal",
|
||||
"footer.site-footer.link.terms-of-service": "Terms of Service & Honor Code",
|
||||
"footer.site-footer.link.privacy": "Privacy Policy",
|
||||
"footer.site-footer.link.accessibility": "Accessibility Policy",
|
||||
"footer.site-footer.link.trademark": "Trademark Policy",
|
||||
"footer.site-footer.link.sitemap": "Sitemap",
|
||||
"footer.site-footer.link.header.connect": "Connect",
|
||||
"footer.site-footer.link.blog": "Blog",
|
||||
"footer.site-footer.link.contact-us": "Contact Us",
|
||||
"footer.site-footer.link.help-center": "Help Center",
|
||||
"footer.site-footer.link.media-kit": "Media Kit",
|
||||
"footer.site-footer.link.donate": "Donate",
|
||||
"footer.site-footer.copyright-text": "{copyrightSymbol} {startDate}–{endDate} {siteName} Inc.",
|
||||
"footer.site-footer.trademark-text": "EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | {icpLicense}",
|
||||
"footer.site-footer.site-logo.alt-text": "{siteName} logo",
|
||||
"footer.site-footer.site-logo.aria-label": "{siteName} Home",
|
||||
"footer.site-footer.facebook.title": "Facebook",
|
||||
"footer.site-footer.facebook.screen-reader-text": "Like {siteName} on Facebook",
|
||||
"footer.site-footer.twitter.title": "Twitter",
|
||||
"footer.site-footer.twitter.screen-reader-text": "Follow {siteName} on Twitter",
|
||||
"footer.site-footer.youtube.title": "Youtube",
|
||||
"footer.site-footer.youtube.screen-reader-text": "Subscribe to the {siteName} YouTube channel",
|
||||
"footer.site-footer.linkedin.title": "LinkedIn",
|
||||
"footer.site-footer.linkedin.screen-reader-text": "Follow {siteName} on LinkedIn",
|
||||
"footer.site-footer.google-plus.title": "Google+",
|
||||
"footer.site-footer.google-plus.screen-reader-text": "Follow {siteName} on Google+",
|
||||
"footer.site-footer.reddit.title": "Reddit",
|
||||
"footer.site-footer.reddit.screen-reader-text": "Subscribe to the {siteName} subreddit",
|
||||
"footer.site-footer.apple-app-store.alt-text": "Download the {siteName} mobile app from the Apple App Store",
|
||||
"footer.site-footer.google-play.alt-text": "Download the {siteName} mobile app from Google Play",
|
||||
"footer.site-footer.footer.aria-label": "Page Footer"
|
||||
}
|
||||
5
src/index.js
Normal file
5
src/index.js
Normal file
@@ -0,0 +1,5 @@
|
||||
import SiteFooter from './lib';
|
||||
|
||||
export { default as FooterLogo } from './config/edx-footer.png';
|
||||
export { default as config } from './config';
|
||||
export default SiteFooter;
|
||||
@@ -1,78 +0,0 @@
|
||||
import React from 'react';
|
||||
import { render } from 'react-dom';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
|
||||
import {
|
||||
faFacebookSquare,
|
||||
faTwitterSquare,
|
||||
faYoutubeSquare,
|
||||
faLinkedin,
|
||||
faGooglePlusSquare,
|
||||
faRedditSquare,
|
||||
} from '@fortawesome/free-brands-svg-icons';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
|
||||
import SiteFooter from './lib';
|
||||
import './index.scss';
|
||||
import FooterLogo from './edx-footer.png';
|
||||
|
||||
|
||||
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: 'Google+',
|
||||
url: 'https://plus.google.com',
|
||||
icon: <FontAwesomeIcon icon={faGooglePlusSquare} className="social-icon" size="2x" />,
|
||||
screenReaderText: 'Follow edX on Google+',
|
||||
},
|
||||
{
|
||||
title: 'Reddit',
|
||||
url: 'https://reddit.com',
|
||||
icon: <FontAwesomeIcon icon={faRedditSquare} className="social-icon" size="2x" />,
|
||||
screenReaderText: 'Subscribe to the edX subreddit',
|
||||
},
|
||||
];
|
||||
|
||||
const App = () => (
|
||||
<IntlProvider locale="en">
|
||||
<SiteFooter
|
||||
siteName="edX"
|
||||
siteLogo={FooterLogo}
|
||||
marketingSiteBaseUrl="https://www.example.com"
|
||||
supportUrl="https://www.example.com/support"
|
||||
contactUrl="https://www.example.com/contact"
|
||||
openSourceUrl="https://www.example.com/open"
|
||||
termsOfServiceUrl="https://www.example.com/terms-of-service"
|
||||
privacyPolicyUrl="https://www.example.com/privacy-policy"
|
||||
appleAppStoreUrl="https://store.apple.com"
|
||||
googlePlayUrl="https://play.google.com"
|
||||
handleAllTrackEvents={() => {}}
|
||||
socialLinks={socialLinks}
|
||||
/>
|
||||
</IntlProvider>
|
||||
);
|
||||
|
||||
render(<App />, document.getElementById('root'));
|
||||
@@ -1,4 +0,0 @@
|
||||
@import "~@edx/edx-bootstrap/sass/edx/theme";
|
||||
@import "~bootstrap/scss/bootstrap";
|
||||
|
||||
@import './lib/scss/_site-footer.scss';
|
||||
260
src/lib/SiteFooter.jsx
Normal file
260
src/lib/SiteFooter.jsx
Normal file
@@ -0,0 +1,260 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import qs from 'query-string';
|
||||
|
||||
export const EVENT_NAMES = {
|
||||
FOOTER_LINK: 'edx.bi.footer.link',
|
||||
};
|
||||
|
||||
export default 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}>
|
||||
<a href={this.formatUrl(link)}>{link.title}</a>
|
||||
</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>
|
||||
<a href={appleAppStore.url} rel="noopener 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"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href={googlePlay.url} rel="noopener 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"
|
||||
/>
|
||||
</a>
|
||||
</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">
|
||||
<a
|
||||
href={marketingSiteBaseUrl}
|
||||
aria-label={siteLogo.ariaLabel}
|
||||
>
|
||||
<img src={siteLogo.src} alt={siteLogo.altText} />
|
||||
</a>
|
||||
{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}>
|
||||
<a
|
||||
href={link.url}
|
||||
title={link.title}
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
onClick={this.externalLinkClickHandler}
|
||||
>
|
||||
{link.icon}
|
||||
<span className="sr-only">{link.screenReaderText}</span>
|
||||
</a>
|
||||
</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,
|
||||
}).isRequired,
|
||||
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 = {
|
||||
marketingSiteBaseUrl: null,
|
||||
linkSectionOne: linkSectionDefault,
|
||||
linkSectionTwo: linkSectionDefault,
|
||||
linkSectionThree: linkSectionDefault,
|
||||
socialLinks: [],
|
||||
showMobileLinks: false,
|
||||
appleAppStore: null,
|
||||
googlePlay: null,
|
||||
supportedLanguages: [],
|
||||
languageForm: null,
|
||||
copyright: null,
|
||||
trademark: null,
|
||||
};
|
||||
348
src/lib/SiteFooter.test.jsx
Normal file
348
src/lib/SiteFooter.test.jsx
Normal 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 '../config/edx-footer.png';
|
||||
import SiteFooter, { EVENT_NAMES } from './SiteFooter';
|
||||
|
||||
|
||||
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="© 2012–2019 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="© 2012–2019 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="© 2012–2019 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="© 2012–2019 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'),
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`<SiteFooter /> renders correctly does not render mobile links 1`] = `
|
||||
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"
|
||||
@@ -13,13 +13,11 @@ exports[`<SiteFooter /> renders correctly does not render mobile links 1`] = `
|
||||
className="area-1"
|
||||
>
|
||||
<a
|
||||
aria-label="example Home"
|
||||
href="https://www.example.com/"
|
||||
onClick={[Function]}
|
||||
target="_self"
|
||||
aria-label="edX Home"
|
||||
href="https://www.example.com"
|
||||
>
|
||||
<img
|
||||
alt="example logo"
|
||||
alt="edx Logo"
|
||||
src="test-file-stub"
|
||||
/>
|
||||
</a>
|
||||
@@ -28,7 +26,7 @@ exports[`<SiteFooter /> renders correctly does not render mobile links 1`] = `
|
||||
className="area-2"
|
||||
>
|
||||
<h2>
|
||||
example
|
||||
edX
|
||||
</h2>
|
||||
<ul
|
||||
className="list-unstyled p-0 m-0"
|
||||
@@ -37,54 +35,42 @@ exports[`<SiteFooter /> renders correctly does not render mobile links 1`] = `
|
||||
<a
|
||||
href="https://www.example.com/about-us"
|
||||
>
|
||||
<span>
|
||||
About
|
||||
</span>
|
||||
About
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/enterprise"
|
||||
href="https://business.edx.org/?utm_test=utm_test_value"
|
||||
>
|
||||
<span>
|
||||
example for Business
|
||||
</span>
|
||||
edX for Business
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/affiliate-program"
|
||||
>
|
||||
<span>
|
||||
Affiliates
|
||||
</span>
|
||||
Affiliates
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/open"
|
||||
>
|
||||
<span>
|
||||
Open example
|
||||
</span>
|
||||
Open edX
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/careers"
|
||||
>
|
||||
<span>
|
||||
Careers
|
||||
</span>
|
||||
Careers
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/news-announcements"
|
||||
>
|
||||
<span>
|
||||
News
|
||||
</span>
|
||||
News
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -93,9 +79,7 @@ exports[`<SiteFooter /> renders correctly does not render mobile links 1`] = `
|
||||
className="area-3"
|
||||
>
|
||||
<h2>
|
||||
<span>
|
||||
Legal
|
||||
</span>
|
||||
Legal
|
||||
</h2>
|
||||
<ul
|
||||
className="list-unstyled p-0 m-0"
|
||||
@@ -104,45 +88,35 @@ exports[`<SiteFooter /> renders correctly does not render mobile links 1`] = `
|
||||
<a
|
||||
href="https://www.example.com/terms-of-service"
|
||||
>
|
||||
<span>
|
||||
Terms of Service & Honor Code
|
||||
</span>
|
||||
Terms of Service & Honor Code
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/privacy-policy"
|
||||
>
|
||||
<span>
|
||||
Privacy Policy
|
||||
</span>
|
||||
Privacy Policy
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/accessibility"
|
||||
>
|
||||
<span>
|
||||
Accessibility Policy
|
||||
</span>
|
||||
Accessibility Policy
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/trademarks"
|
||||
>
|
||||
<span>
|
||||
Trademark Policy
|
||||
</span>
|
||||
Trademark Policy
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/sitemap"
|
||||
>
|
||||
<span>
|
||||
Sitemap
|
||||
</span>
|
||||
Sitemap
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -151,9 +125,7 @@ exports[`<SiteFooter /> renders correctly does not render mobile links 1`] = `
|
||||
className="area-4"
|
||||
>
|
||||
<h2>
|
||||
<span>
|
||||
Connect
|
||||
</span>
|
||||
Connect
|
||||
</h2>
|
||||
<ul
|
||||
className="list-unstyled p-0 m-0"
|
||||
@@ -162,45 +134,35 @@ exports[`<SiteFooter /> renders correctly does not render mobile links 1`] = `
|
||||
<a
|
||||
href="https://www.example.com/blog"
|
||||
>
|
||||
<span>
|
||||
Blog
|
||||
</span>
|
||||
Blog
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/contact"
|
||||
>
|
||||
<span>
|
||||
Contact Us
|
||||
</span>
|
||||
Contact Us
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/support"
|
||||
>
|
||||
<span>
|
||||
Help Center
|
||||
</span>
|
||||
Help Center
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/media-kit"
|
||||
>
|
||||
<span>
|
||||
Media Kit
|
||||
</span>
|
||||
Media Kit
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/donate"
|
||||
>
|
||||
<span>
|
||||
Donate
|
||||
</span>
|
||||
Donate
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -341,16 +303,16 @@ exports[`<SiteFooter /> renders correctly does not render mobile links 1`] = `
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://plus.google.com"
|
||||
href="https://reddit.com"
|
||||
onClick={[Function]}
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
title="Google+"
|
||||
title="Reddit"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
className="svg-inline--fa fa-google-plus-square fa-w-14 fa-2x social-icon"
|
||||
data-icon="google-plus-square"
|
||||
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"
|
||||
@@ -359,7 +321,7 @@ exports[`<SiteFooter /> renders correctly does not render mobile links 1`] = `
|
||||
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-48zM164 356c-55.3 0-100-44.7-100-100s44.7-100 100-100c27 0 49.5 9.8 67 26.2l-27.1 26.1c-7.4-7.1-20.3-15.4-39.8-15.4-34.1 0-61.9 28.2-61.9 63.2 0 34.9 27.8 63.2 61.9 63.2 39.6 0 54.4-28.5 56.8-43.1H164v-34.4h94.4c1 5 1.6 10.1 1.6 16.6 0 57.1-38.3 97.6-96 97.6zm220-81.8h-29v29h-29.2v-29h-29V245h29v-29H355v29h29v29.2z"
|
||||
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 {}}
|
||||
/>
|
||||
@@ -367,7 +329,414 @@ exports[`<SiteFooter /> renders correctly does not render mobile links 1`] = `
|
||||
<span
|
||||
className="sr-only"
|
||||
>
|
||||
Follow edX on Google+
|
||||
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>
|
||||
© 2012–2019 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>
|
||||
@@ -405,13 +774,14 @@ exports[`<SiteFooter /> renders correctly does not render mobile links 1`] = `
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
<span>
|
||||
© 2012–2019 example Inc.
|
||||
</span>
|
||||
© 2012–2019 edX Inc.
|
||||
<br />
|
||||
<span>
|
||||
EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | 粤ICP备17044299号-2
|
||||
</span>
|
||||
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>
|
||||
@@ -431,22 +801,78 @@ exports[`<SiteFooter /> renders correctly does not render social links 1`] = `
|
||||
className="area-1"
|
||||
>
|
||||
<a
|
||||
aria-label="example Home"
|
||||
href="https://www.example.com/"
|
||||
onClick={[Function]}
|
||||
target="_self"
|
||||
aria-label="edX Home"
|
||||
href="https://www.example.com"
|
||||
>
|
||||
<img
|
||||
alt="example logo"
|
||||
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>
|
||||
example
|
||||
edX
|
||||
</h2>
|
||||
<ul
|
||||
className="list-unstyled p-0 m-0"
|
||||
@@ -455,54 +881,42 @@ exports[`<SiteFooter /> renders correctly does not render social links 1`] = `
|
||||
<a
|
||||
href="https://www.example.com/about-us"
|
||||
>
|
||||
<span>
|
||||
About
|
||||
</span>
|
||||
About
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/enterprise"
|
||||
href="https://business.edx.org/?utm_test=utm_test_value"
|
||||
>
|
||||
<span>
|
||||
example for Business
|
||||
</span>
|
||||
edX for Business
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/affiliate-program"
|
||||
>
|
||||
<span>
|
||||
Affiliates
|
||||
</span>
|
||||
Affiliates
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/open"
|
||||
>
|
||||
<span>
|
||||
Open example
|
||||
</span>
|
||||
Open edX
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/careers"
|
||||
>
|
||||
<span>
|
||||
Careers
|
||||
</span>
|
||||
Careers
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/news-announcements"
|
||||
>
|
||||
<span>
|
||||
News
|
||||
</span>
|
||||
News
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -511,9 +925,7 @@ exports[`<SiteFooter /> renders correctly does not render social links 1`] = `
|
||||
className="area-3"
|
||||
>
|
||||
<h2>
|
||||
<span>
|
||||
Legal
|
||||
</span>
|
||||
Legal
|
||||
</h2>
|
||||
<ul
|
||||
className="list-unstyled p-0 m-0"
|
||||
@@ -522,45 +934,35 @@ exports[`<SiteFooter /> renders correctly does not render social links 1`] = `
|
||||
<a
|
||||
href="https://www.example.com/terms-of-service"
|
||||
>
|
||||
<span>
|
||||
Terms of Service & Honor Code
|
||||
</span>
|
||||
Terms of Service & Honor Code
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/privacy-policy"
|
||||
>
|
||||
<span>
|
||||
Privacy Policy
|
||||
</span>
|
||||
Privacy Policy
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/accessibility"
|
||||
>
|
||||
<span>
|
||||
Accessibility Policy
|
||||
</span>
|
||||
Accessibility Policy
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/trademarks"
|
||||
>
|
||||
<span>
|
||||
Trademark Policy
|
||||
</span>
|
||||
Trademark Policy
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/sitemap"
|
||||
>
|
||||
<span>
|
||||
Sitemap
|
||||
</span>
|
||||
Sitemap
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -569,9 +971,7 @@ exports[`<SiteFooter /> renders correctly does not render social links 1`] = `
|
||||
className="area-4"
|
||||
>
|
||||
<h2>
|
||||
<span>
|
||||
Connect
|
||||
</span>
|
||||
Connect
|
||||
</h2>
|
||||
<ul
|
||||
className="list-unstyled p-0 m-0"
|
||||
@@ -580,45 +980,35 @@ exports[`<SiteFooter /> renders correctly does not render social links 1`] = `
|
||||
<a
|
||||
href="https://www.example.com/blog"
|
||||
>
|
||||
<span>
|
||||
Blog
|
||||
</span>
|
||||
Blog
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/contact"
|
||||
>
|
||||
<span>
|
||||
Contact Us
|
||||
</span>
|
||||
Contact Us
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/support"
|
||||
>
|
||||
<span>
|
||||
Help Center
|
||||
</span>
|
||||
Help Center
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/media-kit"
|
||||
>
|
||||
<span>
|
||||
Media Kit
|
||||
</span>
|
||||
Media Kit
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/donate"
|
||||
>
|
||||
<span>
|
||||
Donate
|
||||
</span>
|
||||
Donate
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -637,7 +1027,7 @@ exports[`<SiteFooter /> renders correctly does not render social links 1`] = `
|
||||
target="_blank"
|
||||
>
|
||||
<img
|
||||
alt="Download the example mobile app from the Apple App Store"
|
||||
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"
|
||||
/>
|
||||
@@ -651,7 +1041,7 @@ exports[`<SiteFooter /> renders correctly does not render social links 1`] = `
|
||||
target="_blank"
|
||||
>
|
||||
<img
|
||||
alt="Download the example mobile app from Google Play"
|
||||
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"
|
||||
/>
|
||||
@@ -659,13 +1049,14 @@ exports[`<SiteFooter /> renders correctly does not render social links 1`] = `
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
<span>
|
||||
© 2012–2019 example Inc.
|
||||
</span>
|
||||
© 2012–2019 edX Inc.
|
||||
<br />
|
||||
<span>
|
||||
EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | 粤ICP备17044299号-2
|
||||
</span>
|
||||
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>
|
||||
@@ -685,22 +1076,78 @@ exports[`<SiteFooter /> renders correctly renders with social and mobile links 1
|
||||
className="area-1"
|
||||
>
|
||||
<a
|
||||
aria-label="example Home"
|
||||
href="https://www.example.com/"
|
||||
onClick={[Function]}
|
||||
target="_self"
|
||||
aria-label="edX Home"
|
||||
href="https://www.example.com"
|
||||
>
|
||||
<img
|
||||
alt="example logo"
|
||||
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>
|
||||
example
|
||||
edX
|
||||
</h2>
|
||||
<ul
|
||||
className="list-unstyled p-0 m-0"
|
||||
@@ -709,54 +1156,42 @@ exports[`<SiteFooter /> renders correctly renders with social and mobile links 1
|
||||
<a
|
||||
href="https://www.example.com/about-us"
|
||||
>
|
||||
<span>
|
||||
About
|
||||
</span>
|
||||
About
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/enterprise"
|
||||
href="https://business.edx.org/?utm_test=utm_test_value"
|
||||
>
|
||||
<span>
|
||||
example for Business
|
||||
</span>
|
||||
edX for Business
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/affiliate-program"
|
||||
>
|
||||
<span>
|
||||
Affiliates
|
||||
</span>
|
||||
Affiliates
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/open"
|
||||
>
|
||||
<span>
|
||||
Open example
|
||||
</span>
|
||||
Open edX
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/careers"
|
||||
>
|
||||
<span>
|
||||
Careers
|
||||
</span>
|
||||
Careers
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/news-announcements"
|
||||
>
|
||||
<span>
|
||||
News
|
||||
</span>
|
||||
News
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -765,9 +1200,7 @@ exports[`<SiteFooter /> renders correctly renders with social and mobile links 1
|
||||
className="area-3"
|
||||
>
|
||||
<h2>
|
||||
<span>
|
||||
Legal
|
||||
</span>
|
||||
Legal
|
||||
</h2>
|
||||
<ul
|
||||
className="list-unstyled p-0 m-0"
|
||||
@@ -776,45 +1209,35 @@ exports[`<SiteFooter /> renders correctly renders with social and mobile links 1
|
||||
<a
|
||||
href="https://www.example.com/terms-of-service"
|
||||
>
|
||||
<span>
|
||||
Terms of Service & Honor Code
|
||||
</span>
|
||||
Terms of Service & Honor Code
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/privacy-policy"
|
||||
>
|
||||
<span>
|
||||
Privacy Policy
|
||||
</span>
|
||||
Privacy Policy
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/accessibility"
|
||||
>
|
||||
<span>
|
||||
Accessibility Policy
|
||||
</span>
|
||||
Accessibility Policy
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/trademarks"
|
||||
>
|
||||
<span>
|
||||
Trademark Policy
|
||||
</span>
|
||||
Trademark Policy
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/sitemap"
|
||||
>
|
||||
<span>
|
||||
Sitemap
|
||||
</span>
|
||||
Sitemap
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -823,9 +1246,7 @@ exports[`<SiteFooter /> renders correctly renders with social and mobile links 1
|
||||
className="area-4"
|
||||
>
|
||||
<h2>
|
||||
<span>
|
||||
Connect
|
||||
</span>
|
||||
Connect
|
||||
</h2>
|
||||
<ul
|
||||
className="list-unstyled p-0 m-0"
|
||||
@@ -834,45 +1255,35 @@ exports[`<SiteFooter /> renders correctly renders with social and mobile links 1
|
||||
<a
|
||||
href="https://www.example.com/blog"
|
||||
>
|
||||
<span>
|
||||
Blog
|
||||
</span>
|
||||
Blog
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/contact"
|
||||
>
|
||||
<span>
|
||||
Contact Us
|
||||
</span>
|
||||
Contact Us
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/support"
|
||||
>
|
||||
<span>
|
||||
Help Center
|
||||
</span>
|
||||
Help Center
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/media-kit"
|
||||
>
|
||||
<span>
|
||||
Media Kit
|
||||
</span>
|
||||
Media Kit
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.example.com/donate"
|
||||
>
|
||||
<span>
|
||||
Donate
|
||||
</span>
|
||||
Donate
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -1011,38 +1422,6 @@ exports[`<SiteFooter /> renders correctly renders with social and mobile links 1
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://plus.google.com"
|
||||
onClick={[Function]}
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
title="Google+"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
className="svg-inline--fa fa-google-plus-square fa-w-14 fa-2x social-icon"
|
||||
data-icon="google-plus-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-48zM164 356c-55.3 0-100-44.7-100-100s44.7-100 100-100c27 0 49.5 9.8 67 26.2l-27.1 26.1c-7.4-7.1-20.3-15.4-39.8-15.4-34.1 0-61.9 28.2-61.9 63.2 0 34.9 27.8 63.2 61.9 63.2 39.6 0 54.4-28.5 56.8-43.1H164v-34.4h94.4c1 5 1.6 10.1 1.6 16.6 0 57.1-38.3 97.6-96 97.6zm220-81.8h-29v29h-29.2v-29h-29V245h29v-29H355v29h29v29.2z"
|
||||
fill="currentColor"
|
||||
style={Object {}}
|
||||
/>
|
||||
</svg>
|
||||
<span
|
||||
className="sr-only"
|
||||
>
|
||||
Follow edX on Google+
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://reddit.com"
|
||||
@@ -1087,7 +1466,7 @@ exports[`<SiteFooter /> renders correctly renders with social and mobile links 1
|
||||
target="_blank"
|
||||
>
|
||||
<img
|
||||
alt="Download the example mobile app from the Apple App Store"
|
||||
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"
|
||||
/>
|
||||
@@ -1101,7 +1480,7 @@ exports[`<SiteFooter /> renders correctly renders with social and mobile links 1
|
||||
target="_blank"
|
||||
>
|
||||
<img
|
||||
alt="Download the example mobile app from Google Play"
|
||||
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"
|
||||
/>
|
||||
@@ -1109,13 +1488,14 @@ exports[`<SiteFooter /> renders correctly renders with social and mobile links 1
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
<span>
|
||||
© 2012–2019 example Inc.
|
||||
</span>
|
||||
© 2012–2019 edX Inc.
|
||||
<br />
|
||||
<span>
|
||||
EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | 粤ICP备17044299号-2
|
||||
</span>
|
||||
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>
|
||||
@@ -1,156 +0,0 @@
|
||||
import React from 'react';
|
||||
import renderer from 'react-test-renderer';
|
||||
import { mount } from 'enzyme';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
|
||||
import {
|
||||
faFacebookSquare,
|
||||
faTwitterSquare,
|
||||
faYoutubeSquare,
|
||||
faLinkedin,
|
||||
faGooglePlusSquare,
|
||||
faRedditSquare,
|
||||
} from '@fortawesome/free-brands-svg-icons';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
|
||||
import FooterLogo from '../../../edx-footer.png';
|
||||
import SiteFooter, { EVENT_NAMES } from './index';
|
||||
|
||||
|
||||
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: 'Google+',
|
||||
url: 'https://plus.google.com',
|
||||
icon: <FontAwesomeIcon icon={faGooglePlusSquare} className="social-icon" size="2x" />,
|
||||
screenReaderText: 'Follow edX on Google+',
|
||||
},
|
||||
{
|
||||
title: 'Reddit',
|
||||
url: 'https://reddit.com',
|
||||
icon: <FontAwesomeIcon icon={faRedditSquare} className="social-icon" size="2x" />,
|
||||
screenReaderText: 'Subscribe to the edX subreddit',
|
||||
},
|
||||
];
|
||||
|
||||
const completeSiteFooterComponent = mockHandleAllTrackEvents =>
|
||||
(
|
||||
<IntlProvider locale="en">
|
||||
<SiteFooter
|
||||
siteName="example"
|
||||
siteLogo={FooterLogo}
|
||||
marketingSiteBaseUrl="https://www.example.com"
|
||||
supportUrl="https://www.example.com/support"
|
||||
contactUrl="https://www.example.com/contact"
|
||||
openSourceUrl="https://www.example.com/open"
|
||||
termsOfServiceUrl="https://www.example.com/terms-of-service"
|
||||
privacyPolicyUrl="https://www.example.com/privacy-policy"
|
||||
socialLinks={socialLinks}
|
||||
appleAppStoreUrl="https://store.apple.com"
|
||||
googlePlayUrl="https://play.google.com"
|
||||
handleAllTrackEvents={mockHandleAllTrackEvents}
|
||||
/>
|
||||
</IntlProvider>
|
||||
);
|
||||
|
||||
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((
|
||||
<IntlProvider locale="en">
|
||||
<SiteFooter
|
||||
siteName="example"
|
||||
siteLogo={FooterLogo}
|
||||
marketingSiteBaseUrl="https://www.example.com"
|
||||
supportUrl="https://www.example.com/support"
|
||||
contactUrl="https://www.example.com/contact"
|
||||
openSourceUrl="https://www.example.com/open"
|
||||
termsOfServiceUrl="https://www.example.com/terms-of-service"
|
||||
privacyPolicyUrl="https://www.example.com/privacy-policy"
|
||||
appleAppStoreUrl="https://store.apple.com"
|
||||
googlePlayUrl="https://play.google.com"
|
||||
handleAllTrackEvents={jest.fn()}
|
||||
/>
|
||||
</IntlProvider>
|
||||
)).toJSON();
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('does not render mobile links', () => {
|
||||
const tree = renderer
|
||||
.create((
|
||||
<IntlProvider locale="en">
|
||||
<SiteFooter
|
||||
siteName="example"
|
||||
siteLogo={FooterLogo}
|
||||
marketingSiteBaseUrl="https://www.example.com"
|
||||
supportUrl="https://www.example.com/support"
|
||||
contactUrl="https://www.example.com/contact"
|
||||
openSourceUrl="https://www.example.com/open"
|
||||
termsOfServiceUrl="https://www.example.com/terms-of-service"
|
||||
privacyPolicyUrl="https://www.example.com/privacy-policy"
|
||||
socialLinks={socialLinks}
|
||||
appleAppStoreUrl="https://store.apple.com"
|
||||
googlePlayUrl="https://play.google.com"
|
||||
handleAllTrackEvents={jest.fn()}
|
||||
showMobileLinks={false}
|
||||
/>
|
||||
</IntlProvider>
|
||||
)).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).toHaveLength(8);
|
||||
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'),
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,356 +0,0 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FormattedMessage, injectIntl, intlShape } from 'react-intl';
|
||||
import { Hyperlink } from '@edx/paragon';
|
||||
import messages from './SiteFooter.messages';
|
||||
|
||||
const EVENT_NAMES = {
|
||||
FOOTER_LINK: 'edx.bi.footer.link',
|
||||
};
|
||||
|
||||
class SiteFooter extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.externalLinkClickHandler = this.externalLinkClickHandler.bind(this);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
renderSiteLogo() {
|
||||
return (
|
||||
<img
|
||||
src={this.props.siteLogo}
|
||||
alt={this.props.intl.formatMessage(
|
||||
messages['footer.site-footer.site-logo.alt-text'],
|
||||
{ siteName: this.props.siteName },
|
||||
)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
renderMarketingSiteUrl(path) {
|
||||
return `${this.props.marketingSiteBaseUrl}${path}`;
|
||||
}
|
||||
|
||||
renderMobileLinks() {
|
||||
const {
|
||||
intl,
|
||||
siteName,
|
||||
showMobileLinks,
|
||||
appleAppStoreUrl,
|
||||
googlePlayUrl,
|
||||
} = this.props;
|
||||
let mobileLinks = null;
|
||||
if (showMobileLinks) {
|
||||
mobileLinks = (
|
||||
<ul className="d-flex flex-row justify-content-between list-unstyled max-width-264 p-0 mb-5">
|
||||
<li>
|
||||
<a href={appleAppStoreUrl} rel="noopener noreferrer" target="_blank" onClick={this.externalLinkClickHandler}>
|
||||
<img
|
||||
className="max-height-39"
|
||||
alt={intl.formatMessage(
|
||||
messages['footer.site-footer.apple-app-store.alt-text'],
|
||||
{ siteName },
|
||||
)}
|
||||
src="https://prod-edxapp.edx-cdn.org/static/images/app/app_store_badge_135x40.d0558d910630.svg"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href={googlePlayUrl} rel="noopener noreferrer" target="_blank" onClick={this.externalLinkClickHandler}>
|
||||
<img
|
||||
className="max-height-39"
|
||||
alt={intl.formatMessage(
|
||||
messages['footer.site-footer.google-play.alt-text'],
|
||||
{ siteName },
|
||||
)}
|
||||
src="https://prod-edxapp.edx-cdn.org/static/images/app/google_play_badge_45.6ea466e328da.png"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
return mobileLinks;
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
intl,
|
||||
siteName,
|
||||
openSourceUrl,
|
||||
termsOfServiceUrl,
|
||||
privacyPolicyUrl,
|
||||
contactUrl,
|
||||
supportUrl,
|
||||
socialLinks,
|
||||
} = this.props;
|
||||
return (
|
||||
<footer
|
||||
role="contentinfo"
|
||||
aria-label={intl.formatMessage(messages['footer.site-footer.footer.aria-label'])}
|
||||
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={this.renderMarketingSiteUrl('/')}
|
||||
content={this.renderSiteLogo()}
|
||||
aria-label={intl.formatMessage(
|
||||
messages['footer.site-footer.site-logo.aria-label'],
|
||||
{ siteName },
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="area-2">
|
||||
<h2>{siteName}</h2>
|
||||
<ul className="list-unstyled p-0 m-0">
|
||||
<li>
|
||||
<a href={this.renderMarketingSiteUrl('/about-us')}>
|
||||
<FormattedMessage
|
||||
id="footer.site-footer.link.about"
|
||||
defaultMessage="About"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href={this.renderMarketingSiteUrl('/enterprise')}>
|
||||
<FormattedMessage
|
||||
id="footer.site-footer.link.business"
|
||||
defaultMessage="{siteName} for Business"
|
||||
values={{ siteName }}
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href={this.renderMarketingSiteUrl('/affiliate-program')}>
|
||||
<FormattedMessage
|
||||
id="footer.site-footer.link.affiliates"
|
||||
defaultMessage="Affiliates"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href={openSourceUrl}>
|
||||
<FormattedMessage
|
||||
id="footer.site-footer.link.open-source"
|
||||
defaultMessage="Open {siteName}"
|
||||
values={{ siteName }}
|
||||
description="Open Source link text"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href={this.renderMarketingSiteUrl('/careers')}>
|
||||
<FormattedMessage
|
||||
id="footer.site-footer.link.careers"
|
||||
defaultMessage="Careers"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href={this.renderMarketingSiteUrl('/news-announcements')}>
|
||||
<FormattedMessage
|
||||
id="footer.site-footer.link.news"
|
||||
defaultMessage="News"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div className="area-3">
|
||||
<h2>
|
||||
<FormattedMessage
|
||||
id="footer.site-footer.link.header.legal"
|
||||
defaultMessage="Legal"
|
||||
description="Header for legal links"
|
||||
/>
|
||||
</h2>
|
||||
<ul className="list-unstyled p-0 m-0">
|
||||
<li>
|
||||
<a href={termsOfServiceUrl}>
|
||||
<FormattedMessage
|
||||
id="footer.site-footer.link.terms-of-service"
|
||||
defaultMessage="Terms of Service & Honor Code"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href={privacyPolicyUrl}>
|
||||
<FormattedMessage
|
||||
id="footer.site-footer.link.privacy"
|
||||
defaultMessage="Privacy Policy"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href={this.renderMarketingSiteUrl('/accessibility')}>
|
||||
<FormattedMessage
|
||||
id="footer.site-footer.link.accessibility"
|
||||
defaultMessage="Accessibility Policy"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href={this.renderMarketingSiteUrl('/trademarks')}>
|
||||
<FormattedMessage
|
||||
id="footer.site-footer.link.trademark"
|
||||
defaultMessage="Trademark Policy"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href={this.renderMarketingSiteUrl('/sitemap')}>
|
||||
<FormattedMessage
|
||||
id="footer.site-footer.link.sitemap"
|
||||
defaultMessage="Sitemap"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div className="area-4">
|
||||
<h2>
|
||||
<FormattedMessage
|
||||
id="footer.site-footer.link.header.connect"
|
||||
defaultMessage="Connect"
|
||||
description="Header for connect links"
|
||||
/>
|
||||
</h2>
|
||||
<ul className="list-unstyled p-0 m-0">
|
||||
<li>
|
||||
<a href={this.renderMarketingSiteUrl('/blog')}>
|
||||
<FormattedMessage
|
||||
id="footer.site-footer.link.blog"
|
||||
defaultMessage="Blog"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href={contactUrl}>
|
||||
<FormattedMessage
|
||||
id="footer.site-footer.link.contact-us"
|
||||
defaultMessage="Contact Us"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href={supportUrl}>
|
||||
<FormattedMessage
|
||||
id="footer.site-footer.link.help-center"
|
||||
defaultMessage="Help Center"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href={this.renderMarketingSiteUrl('/media-kit')}>
|
||||
<FormattedMessage
|
||||
id="footer.site-footer.link.media-kit"
|
||||
defaultMessage="Media Kit"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href={this.renderMarketingSiteUrl('/donate')}>
|
||||
<FormattedMessage
|
||||
id="footer.site-footer.link.donate"
|
||||
defaultMessage="Donate"
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</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}>
|
||||
<a
|
||||
href={link.url}
|
||||
title={link.title}
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
onClick={this.externalLinkClickHandler}
|
||||
>
|
||||
{link.icon}
|
||||
<span className="sr-only">{link.screenReaderText}</span>
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
}
|
||||
{this.renderMobileLinks()}
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="footer.site-footer.copyright-text"
|
||||
defaultMessage="{copyrightSymbol} {startDate}–{endDate} {siteName} Inc."
|
||||
values={{
|
||||
copyrightSymbol: '©',
|
||||
startDate: '2012',
|
||||
endDate: `${new Date().getFullYear()}`,
|
||||
siteName,
|
||||
}}
|
||||
description="Footer copyright text with copyright symbol and dates"
|
||||
/>
|
||||
<br />
|
||||
<FormattedMessage
|
||||
id="footer.site-footer.trademark-text"
|
||||
defaultMessage="EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | {icpLicense}"
|
||||
values={{ icpLicense: '粤ICP备17044299号-2' }}
|
||||
description="Footer trademark text"
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
SiteFooter.propTypes = {
|
||||
siteName: PropTypes.string,
|
||||
siteLogo: PropTypes.node,
|
||||
marketingSiteBaseUrl: PropTypes.string,
|
||||
supportUrl: PropTypes.string,
|
||||
contactUrl: PropTypes.string,
|
||||
openSourceUrl: PropTypes.string,
|
||||
termsOfServiceUrl: PropTypes.string,
|
||||
privacyPolicyUrl: PropTypes.string,
|
||||
socialLinks: PropTypes.arrayOf(PropTypes.shape({
|
||||
title: PropTypes.string.isRequired,
|
||||
url: PropTypes.string.isRequired,
|
||||
icon: PropTypes.element.isRequired,
|
||||
screenReaderText: PropTypes.string.isRequired,
|
||||
})),
|
||||
showMobileLinks: PropTypes.bool,
|
||||
appleAppStoreUrl: PropTypes.string,
|
||||
googlePlayUrl: PropTypes.string,
|
||||
handleAllTrackEvents: PropTypes.func.isRequired,
|
||||
intl: intlShape.isRequired,
|
||||
};
|
||||
|
||||
SiteFooter.defaultProps = {
|
||||
siteName: null,
|
||||
siteLogo: null,
|
||||
marketingSiteBaseUrl: null,
|
||||
supportUrl: null,
|
||||
contactUrl: null,
|
||||
openSourceUrl: null,
|
||||
termsOfServiceUrl: null,
|
||||
privacyPolicyUrl: null,
|
||||
socialLinks: [],
|
||||
showMobileLinks: true,
|
||||
appleAppStoreUrl: null,
|
||||
googlePlayUrl: null,
|
||||
};
|
||||
|
||||
export default injectIntl(SiteFooter);
|
||||
export { EVENT_NAMES };
|
||||
@@ -1,3 +1,3 @@
|
||||
import SiteFooter from './components/SiteFooter';
|
||||
import SiteFooter from './SiteFooter';
|
||||
|
||||
export default SiteFooter;
|
||||
|
||||
Reference in New Issue
Block a user