Compare commits
69 Commits
v2.0.2
...
abutterwor
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a820357ee | ||
|
|
c99c06ba87 | ||
|
|
637282d20b | ||
|
|
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 | ||
|
|
da91fb6392 | ||
|
|
f265c7daa6 | ||
|
|
3037e4d8a6 | ||
|
|
b2a7696c0e | ||
|
|
6dc8f64ccb | ||
|
|
0453d7fbaa | ||
|
|
fa6d38f422 | ||
|
|
9f3e945d4e | ||
|
|
429d19291d | ||
|
|
e27bc8de39 | ||
|
|
cd0b84c223 | ||
|
|
26810c99e6 | ||
|
|
2fb8ea2608 | ||
|
|
16c6da229b | ||
|
|
fb8de7a59c | ||
|
|
21a9e6c5e1 | ||
|
|
9475888392 | ||
|
|
c069f20716 | ||
|
|
46772ecc0e | ||
|
|
ca09a07c62 | ||
|
|
66f6832887 | ||
|
|
8f35487558 | ||
|
|
349a458617 | ||
|
|
abe3d03f58 | ||
|
|
7af4b71faa |
44
.babelrc
44
.babelrc
@@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
"env": {
|
|
||||||
"development": {
|
|
||||||
"presets": [
|
|
||||||
["env", {
|
|
||||||
"targets": {
|
|
||||||
"browsers": ["last 2 versions", "ie 11"]
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
"babel-preset-react"
|
|
||||||
],
|
|
||||||
"plugins": [
|
|
||||||
"transform-object-rest-spread"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"test": {
|
|
||||||
"presets": [
|
|
||||||
["env", {
|
|
||||||
"targets": {
|
|
||||||
"browsers": ["last 2 versions", "ie 11"]
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
"babel-preset-react"
|
|
||||||
],
|
|
||||||
"plugins": [
|
|
||||||
"rewire",
|
|
||||||
"transform-object-rest-spread"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"production": {
|
|
||||||
"presets": [
|
|
||||||
["env", {
|
|
||||||
"targets": {
|
|
||||||
"browsers": ["last 2 versions", "ie 11"]
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
"babel-preset-react"
|
|
||||||
],
|
|
||||||
"plugins": [
|
|
||||||
"transform-object-rest-spread"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "eslint-config-edx",
|
|
||||||
"rules": {
|
|
||||||
"import/no-extraneous-dependencies": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"devDependencies": [
|
|
||||||
"webpack.config.js",
|
|
||||||
"src/tests/setupTest.js",
|
|
||||||
"**/*.test.jsx",
|
|
||||||
"**/*.test.js"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"env": {
|
|
||||||
"jest": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,5 +1,10 @@
|
|||||||
|
.DS_Store
|
||||||
coverage
|
coverage
|
||||||
dist
|
dist
|
||||||
node_modules
|
node_modules
|
||||||
|
temp
|
||||||
|
|
||||||
.idea/
|
.idea/
|
||||||
|
|
||||||
|
src/i18n/transifex_input.json
|
||||||
|
temp/babel-plugin-react-intl
|
||||||
|
|||||||
@@ -1,17 +1,14 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js: 12
|
||||||
- 8
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- "~/.npm"
|
|
||||||
install:
|
install:
|
||||||
- npm install
|
- npm install
|
||||||
script:
|
script:
|
||||||
- npm run lint
|
- npm run lint
|
||||||
|
- npm run i18n_extract
|
||||||
- npm run test
|
- npm run test
|
||||||
- npm run build
|
- npm run build
|
||||||
after_success:
|
after_success:
|
||||||
- npm run travis-deploy-once "npm run semantic-release"
|
- npx semantic-release
|
||||||
- npm run coveralls
|
- npm run coveralls
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
|
|||||||
8
.tx/config
Normal file
8
.tx/config
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[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
|
||||||
58
Makefile
Executable file
58
Makefile
Executable file
@@ -0,0 +1,58 @@
|
|||||||
|
transifex_resource = frontend-component-footer
|
||||||
|
transifex_langs = "ar,fr,es_419,zh_CN"
|
||||||
|
|
||||||
|
transifex_utils = ./node_modules/.bin/transifex-utils.js
|
||||||
|
i18n = ./src/i18n
|
||||||
|
transifex_input = $(i18n)/transifex_input.json
|
||||||
|
tx_url1 = https://www.transifex.com/api/2/project/edx-platform/resource/$(transifex_resource)/translation/en/strings/
|
||||||
|
tx_url2 = https://www.transifex.com/api/2/project/edx-platform/resource/$(transifex_resource)/source/
|
||||||
|
|
||||||
|
# This directory must match .babelrc .
|
||||||
|
transifex_temp = ./temp/babel-plugin-react-intl
|
||||||
|
|
||||||
|
build:
|
||||||
|
rm -rf ./dist
|
||||||
|
./node_modules/.bin/fedx-scripts babel src --out-dir dist --source-maps --ignore **/*.test.jsx,**/__mocks__,**/__snapshots__,**/setupTest.js --copy-files
|
||||||
|
@# --copy-files will bring in everything else that wasn't processed by babel. Remove what we don't want.
|
||||||
|
@rm -rf dist/**/*.test.jsx
|
||||||
|
@rm -rf dist/**/__snapshots__
|
||||||
|
@rm -rf dist/__mocks__
|
||||||
|
|
||||||
|
requirements:
|
||||||
|
npm install
|
||||||
|
|
||||||
|
i18n.extract:
|
||||||
|
# Pulling display strings from .jsx files into .json files...
|
||||||
|
rm -rf $(transifex_temp)
|
||||||
|
npm run-script i18n_extract
|
||||||
|
|
||||||
|
i18n.concat:
|
||||||
|
# Gathering JSON messages into one file...
|
||||||
|
$(transifex_utils) $(transifex_temp) $(transifex_input)
|
||||||
|
|
||||||
|
extract_translations: | requirements i18n.extract i18n.concat
|
||||||
|
|
||||||
|
# Despite the name, we actually need this target to detect changes in the incoming translated message files as well.
|
||||||
|
detect_changed_source_translations:
|
||||||
|
# Checking for changed translations...
|
||||||
|
git diff --exit-code $(i18n)
|
||||||
|
|
||||||
|
# Pushes translations to Transifex. You must run make extract_translations first.
|
||||||
|
push_translations:
|
||||||
|
# Pushing strings to Transifex...
|
||||||
|
tx push -s
|
||||||
|
# Fetching hashes from Transifex...
|
||||||
|
./node_modules/reactifex/bash_scripts/get_hashed_strings.sh $(tx_url1)
|
||||||
|
# Writing out comments to file...
|
||||||
|
$(transifex_utils) $(transifex_temp) --comments
|
||||||
|
# Pushing comments to Transifex...
|
||||||
|
./node_modules/reactifex/bash_scripts/put_comments.sh $(tx_url2)
|
||||||
|
|
||||||
|
# Pulls translations from Transifex.
|
||||||
|
pull_translations:
|
||||||
|
tx pull -f --mode reviewed --language=$(transifex_langs)
|
||||||
|
|
||||||
|
# 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
|
||||||
37
README.rst
37
README.rst
@@ -5,10 +5,7 @@ frontend-component-footer
|
|||||||
|semantic-release|
|
|semantic-release|
|
||||||
|
|
||||||
frontend-component-footer is a library containing a site footer
|
frontend-component-footer is a library containing a site footer
|
||||||
component for use when building edX frontend applications.
|
component for use when building Open edX frontend applications.
|
||||||
|
|
||||||
At this time, this componenet is hard-coded to match the legacy LMS site footer, including all of its links.
|
|
||||||
Note: As implemented, it should really be called the ``frontend-component-lms-footer``.
|
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
@@ -17,9 +14,35 @@ To install frontend-component-footer into your project::
|
|||||||
|
|
||||||
npm i --save @edx/frontend-component-footer
|
npm i --save @edx/frontend-component-footer
|
||||||
|
|
||||||
The component expects properties specifying the various URLs that are
|
Component Usage::
|
||||||
linked in the footer. See the sample app in src/index.jsx for an example
|
|
||||||
of how the SiteFooter component can be specified.
|
import Footer from '@edx/frontend-component-footer';
|
||||||
|
import footerMessages from '@edx/frontend-component-footer/src/i18n/index';
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
<Footer
|
||||||
|
handleAllTrackEvents={(eventName, properties) => {/* track click event */}}
|
||||||
|
onLanguageSelected={(languageCode) => {/* set language */}}
|
||||||
|
supportedLanguages={[
|
||||||
|
{ label: 'English', value: 'en'},
|
||||||
|
{ label: 'Español', value: 'es' },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
|
||||||
|
- handleAllTrackEvents (required)
|
||||||
|
- onLanguageSelected (optional)
|
||||||
|
- supportedLanguages (optional)
|
||||||
|
|
||||||
|
Styles (project.scss)::
|
||||||
|
|
||||||
|
@import '@edx/frontend-component-footer/src/footer.scss';
|
||||||
|
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
This component uses ``@edx/frontend-i18n``. Any containing app must provide ``@edx/frontend-i18n`` as a peer dependency, and be wrapped inside an ``IntlProvider`` element, whether or not your consuming application is actually localized. For a basic default locale (English) version, follow the ``IntlProvider`` example in the sample application in `src/index.jsx <src/index.jsx>`__.
|
||||||
|
|
||||||
Development
|
Development
|
||||||
-----------
|
-----------
|
||||||
|
|||||||
35
babel.config.js
Normal file
35
babel.config.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
// These preset packages are included by frontend-build.
|
||||||
|
// TODO: Add to frontend-build and leverage that config.
|
||||||
|
module.exports = {
|
||||||
|
presets: [
|
||||||
|
[
|
||||||
|
'@babel/preset-env',
|
||||||
|
{
|
||||||
|
modules: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'@babel/preset-react',
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
'@babel/plugin-proposal-object-rest-spread',
|
||||||
|
'@babel/plugin-proposal-class-properties',
|
||||||
|
],
|
||||||
|
env: {
|
||||||
|
i18n: {
|
||||||
|
plugins: [
|
||||||
|
[
|
||||||
|
'react-intl',
|
||||||
|
{
|
||||||
|
messagesDir: './temp/babel-plugin-react-intl',
|
||||||
|
moduleSourceName: '@edx/frontend-i18n',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
test: {
|
||||||
|
presets: [
|
||||||
|
'@babel/preset-env',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -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,58 +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',
|
|
||||||
},
|
|
||||||
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' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
25
example/index.jsx
Normal file
25
example/index.jsx
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { render } from 'react-dom';
|
||||||
|
import { IntlProvider } from '@edx/frontend-i18n';
|
||||||
|
|
||||||
|
import './index.scss';
|
||||||
|
import Footer from '../src';
|
||||||
|
|
||||||
|
const App = () => (
|
||||||
|
<div>
|
||||||
|
<IntlProvider locale="en">
|
||||||
|
<Footer
|
||||||
|
/* eslint-disable-next-line no-unused-vars */
|
||||||
|
handleAllTrackEvents={(eventName, properties) => {}}
|
||||||
|
/* eslint-disable-next-line no-unused-vars */
|
||||||
|
onLanguageSelected={(languageCode) => {}}
|
||||||
|
supportedLanguages={[
|
||||||
|
{ label: 'English', value: 'en' },
|
||||||
|
{ label: 'Español', value: 'es' },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</IntlProvider>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
render(<App />, document.getElementById('root'));
|
||||||
2
example/index.scss
Normal file
2
example/index.scss
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
@import "~@edx/paragon/scss/core/core.scss";
|
||||||
|
@import "../src/footer";
|
||||||
7
jest.config.js
Normal file
7
jest.config.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
const { createConfig } = require('@edx/frontend-build');
|
||||||
|
|
||||||
|
module.exports = createConfig('jest', {
|
||||||
|
setupFiles: [
|
||||||
|
'<rootDir>/src/setupTest.js',
|
||||||
|
],
|
||||||
|
});
|
||||||
8
openedx.yaml
Normal file
8
openedx.yaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# openedx.yaml
|
||||||
|
|
||||||
|
---
|
||||||
|
owner: edx/fedx-team
|
||||||
|
tags:
|
||||||
|
- library
|
||||||
|
- component
|
||||||
|
- react
|
||||||
21527
package-lock.json
generated
21527
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
84
package.json
84
package.json
@@ -2,25 +2,22 @@
|
|||||||
"name": "@edx/frontend-component-footer",
|
"name": "@edx/frontend-component-footer",
|
||||||
"version": "1.0.0-semantically-released",
|
"version": "1.0.0-semantically-released",
|
||||||
"description": "Site footer component for use when building edX frontend applications",
|
"description": "Site footer component for use when building edX frontend applications",
|
||||||
"main": "dist/main.js",
|
"main": "dist/index.js",
|
||||||
"module": "dist/main.js",
|
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "NODE_ENV=production BABEL_ENV=production webpack --config=config/webpack.prod.config.js",
|
"build": "make build",
|
||||||
"gc": "commit",
|
"gc": "commit",
|
||||||
"commitmsg": "commitlint -e $GIT_PARAMS",
|
"commitmsg": "commitlint -e $GIT_PARAMS",
|
||||||
"coveralls": "cat ./coverage/lcov.info | coveralls",
|
"coveralls": "cat ./coverage/lcov.info | coveralls",
|
||||||
"lint": "eslint --ext .js --ext .jsx .",
|
"i18n_extract": "BABEL_ENV=i18n fedx-scripts babel src --quiet > /dev/null",
|
||||||
|
"lint": "fedx-scripts eslint --ext .js --ext .jsx .",
|
||||||
"precommit": "npm run lint",
|
"precommit": "npm run lint",
|
||||||
"prepublishOnly": "npm run build",
|
"prepublishOnly": "npm run build",
|
||||||
"semantic-release": "semantic-release",
|
"start": "fedx-scripts webpack-dev-server --progress",
|
||||||
"start": "NODE_ENV=development BABEL_ENV=development node_modules/.bin/webpack-dev-server --config=config/webpack.dev.config.js --progress",
|
"test": "fedx-scripts jest --coverage",
|
||||||
"test": "jest --coverage",
|
"snapshot": "fedx-scripts jest --updateSnapshot"
|
||||||
"snapshot": "jest --updateSnapshot",
|
|
||||||
"travis-deploy-once": "travis-deploy-once",
|
|
||||||
"watch": "watch 'npm run build' ./src"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -37,68 +34,33 @@
|
|||||||
"@commitlint/config-angular": "^6.0.2",
|
"@commitlint/config-angular": "^6.0.2",
|
||||||
"@commitlint/prompt": "^6.0.2",
|
"@commitlint/prompt": "^6.0.2",
|
||||||
"@commitlint/prompt-cli": "^6.0.2",
|
"@commitlint/prompt-cli": "^6.0.2",
|
||||||
"babel-cli": "^6.26.0",
|
"@edx/frontend-build": "^1.0.1",
|
||||||
"babel-core": "^6.26.3",
|
"@edx/frontend-i18n": "^2.1.0",
|
||||||
"babel-loader": "^7.1.5",
|
"@edx/frontend-logging": "^2.0.2",
|
||||||
"babel-plugin-rewire": "^1.2.0",
|
"@edx/paragon": "^7.1.3",
|
||||||
"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",
|
"coveralls": "^3.0.0",
|
||||||
"css-loader": "^0.28.9",
|
|
||||||
"@edx/paragon": "^3.8.0",
|
|
||||||
"enzyme": "^3.3.0",
|
"enzyme": "^3.3.0",
|
||||||
"enzyme-adapter-react-16": "^1.1.1",
|
"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",
|
|
||||||
"html-webpack-plugin": "^3.2.0",
|
|
||||||
"image-webpack-loader": "^4.2.0",
|
|
||||||
"husky": "^0.14.3",
|
"husky": "^0.14.3",
|
||||||
"jest": "23.6.0",
|
|
||||||
"node-sass": "^4.7.2",
|
|
||||||
"prop-types": "^15.5.10",
|
"prop-types": "^15.5.10",
|
||||||
"react": "^16.4.2",
|
"react": "^16.4.2",
|
||||||
"react-dom": "^16.2.0",
|
"react-dom": "^16.2.0",
|
||||||
"react-dev-utils": "^5.0.0",
|
|
||||||
"react-test-renderer": "^16.6.0",
|
"react-test-renderer": "^16.6.0",
|
||||||
"sass-loader": "^6.0.6",
|
"reactifex": "^1.1.1"
|
||||||
"semantic-release": "^15.1.7",
|
},
|
||||||
"source-map-loader": "^0.2.1",
|
"dependencies": {
|
||||||
"style-loader": "^0.20.2",
|
"@fortawesome/fontawesome-svg-core": "^1.2.17",
|
||||||
"travis-deploy-once": "^5.0.0",
|
"@fortawesome/free-brands-svg-icons": "^5.8.1",
|
||||||
"watch": "^1.0.2",
|
"@fortawesome/free-regular-svg-icons": "^5.8.1",
|
||||||
"webpack": "^4.19.1",
|
"@fortawesome/free-solid-svg-icons": "^5.8.1",
|
||||||
"webpack-cli": "^3.1.0",
|
"@fortawesome/react-fontawesome": "^0.1.4"
|
||||||
"webpack-dev-server": "^3.1.9",
|
|
||||||
"webpack-merge": "^4.2.1"
|
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@edx/paragon": "^3.8.0",
|
"@edx/frontend-i18n": "^2.1.0",
|
||||||
"clean-webpack-plugin": "^0.1.19",
|
"@edx/frontend-logging": "^2.0.2",
|
||||||
"html-webpack-plugin": "^3.2.0",
|
"@edx/paragon": "^7.1.3",
|
||||||
"prop-types": "^15.5.10",
|
"prop-types": "^15.5.10",
|
||||||
"react": "^16.4.2",
|
"react": "^16.4.2",
|
||||||
"react-dom": "^16.2.0",
|
"react-dom": "^16.2.0"
|
||||||
"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"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en-us">
|
<html lang="en-us" dir="ltr">
|
||||||
<head>
|
<head>
|
||||||
<title>Footer | edX</title>
|
<title>Footer</title>
|
||||||
<meta charset="utf-8">
|
<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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
|||||||
5
src/_footer.scss
Normal file
5
src/_footer.scss
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
$gray-footer: #fcfcfc !default;
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
background-color: $gray-footer;
|
||||||
|
}
|
||||||
95
src/components/Footer.jsx
Normal file
95
src/components/Footer.jsx
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { injectIntl, intlShape } from '@edx/frontend-i18n';
|
||||||
|
|
||||||
|
import messages from './Footer.messages';
|
||||||
|
import FooterLogo from '../edx-openedx-logo-tag.png';
|
||||||
|
import LanguageSelector from './LanguageSelector';
|
||||||
|
|
||||||
|
const EVENT_NAMES = {
|
||||||
|
FOOTER_LINK: 'edx.bi.footer.link',
|
||||||
|
};
|
||||||
|
|
||||||
|
class SiteFooter extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.externalLinkClickHandler = this.externalLinkClickHandler.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
getLocalePrefix(locale) {
|
||||||
|
const twoLetterPrefix = locale.substring(0, 2).toLowerCase();
|
||||||
|
if (twoLetterPrefix === 'en') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return `/${twoLetterPrefix}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
externalLinkClickHandler(event) {
|
||||||
|
const label = event.currentTarget.getAttribute('href');
|
||||||
|
const eventName = EVENT_NAMES.FOOTER_LINK;
|
||||||
|
const properties = {
|
||||||
|
category: 'outbound_link',
|
||||||
|
label,
|
||||||
|
};
|
||||||
|
this.props.handleAllTrackEvents(eventName, properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
supportedLanguages,
|
||||||
|
onLanguageSelected,
|
||||||
|
logo,
|
||||||
|
intl,
|
||||||
|
} = this.props;
|
||||||
|
const showLanguageSelector = supportedLanguages.length > 0 && onLanguageSelected;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<footer
|
||||||
|
role="contentinfo"
|
||||||
|
aria-label={intl.formatMessage(messages['footer.logo.ariaLabel'])}
|
||||||
|
className="footer d-flex border-top py-3 px-4"
|
||||||
|
>
|
||||||
|
<div className="container d-flex">
|
||||||
|
<a
|
||||||
|
className="d-block mb-3"
|
||||||
|
href="https://open.edx.org"
|
||||||
|
aria-label={intl.formatMessage(messages['footer.logo.ariaLabel'])}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
style={{ maxWidth: 150 }}
|
||||||
|
src={logo || FooterLogo}
|
||||||
|
alt={intl.formatMessage(messages['footer.logo.altText'])}
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
<div className="flex-grow-1" />
|
||||||
|
{showLanguageSelector &&
|
||||||
|
<LanguageSelector
|
||||||
|
options={supportedLanguages}
|
||||||
|
onSubmit={onLanguageSelected}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SiteFooter.propTypes = {
|
||||||
|
intl: intlShape.isRequired,
|
||||||
|
logo: PropTypes.string,
|
||||||
|
onLanguageSelected: PropTypes.func,
|
||||||
|
supportedLanguages: PropTypes.arrayOf(PropTypes.shape({
|
||||||
|
label: PropTypes.string.isRequired,
|
||||||
|
value: PropTypes.string.isRequired,
|
||||||
|
})),
|
||||||
|
handleAllTrackEvents: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
SiteFooter.defaultProps = {
|
||||||
|
logo: undefined,
|
||||||
|
onLanguageSelected: undefined,
|
||||||
|
supportedLanguages: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
export default injectIntl(SiteFooter);
|
||||||
|
export { EVENT_NAMES };
|
||||||
156
src/components/Footer.messages.js
Normal file
156
src/components/Footer.messages.js
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
import { defineMessages } from '@edx/frontend-i18n';
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
'footer.socialLinks.srText.facebook': {
|
||||||
|
id: 'footer.socialLinks.srText.facebook',
|
||||||
|
defaultMessage: 'Like edX on Facebook',
|
||||||
|
description: 'This is screenreader text for the edX Facebook social media link in the footer.',
|
||||||
|
},
|
||||||
|
'footer.socialLinks.srText.twitter': {
|
||||||
|
id: 'footer.socialLinks.srText.twitter',
|
||||||
|
defaultMessage: 'Follow edX on Twitter',
|
||||||
|
description: 'This is screenreader text for the edX Twitter social media link in the footer.',
|
||||||
|
},
|
||||||
|
'footer.socialLinks.srText.youtube': {
|
||||||
|
id: 'footer.socialLinks.srText.youtube',
|
||||||
|
defaultMessage: 'Subscribe to the edX YouTube channel',
|
||||||
|
description: 'This is screenreader text for the edX YouTube social media link in the footer.',
|
||||||
|
},
|
||||||
|
'footer.socialLinks.srText.linkedin': {
|
||||||
|
id: 'footer.socialLinks.srText.linkedin',
|
||||||
|
defaultMessage: 'Follow edX on LinkedIn',
|
||||||
|
description: 'This is screenreader text for the edX LinkedIn social media link in the footer.',
|
||||||
|
},
|
||||||
|
'footer.socialLinks.srText.reddit': {
|
||||||
|
id: 'footer.socialLinks.srText.reddit',
|
||||||
|
defaultMessage: 'Subscribe to the edX subreddit',
|
||||||
|
description: 'This is screenreader text for the edX reddit social media link in the footer.',
|
||||||
|
},
|
||||||
|
'footer.languageForm.select.label': {
|
||||||
|
id: 'footer.languageForm.select.label',
|
||||||
|
defaultMessage: 'Choose Language',
|
||||||
|
description: 'The label for the laguage select part of the language selection form.',
|
||||||
|
},
|
||||||
|
'footer.languageForm.submit.label': {
|
||||||
|
id: 'footer.languageForm.submit.label',
|
||||||
|
defaultMessage: 'Apply',
|
||||||
|
description: 'The label for button to submit the language selection form.',
|
||||||
|
},
|
||||||
|
'footer.edxLinks.about': {
|
||||||
|
id: 'footer.edxLinks.about',
|
||||||
|
defaultMessage: 'About',
|
||||||
|
description: 'The label for the link to the about edX page.',
|
||||||
|
},
|
||||||
|
'footer.edxLinks.business': {
|
||||||
|
id: 'footer.edxLinks.business',
|
||||||
|
defaultMessage: 'edX for Business',
|
||||||
|
description: 'The label for the link to the edX for business page.',
|
||||||
|
},
|
||||||
|
'footer.edxLinks.affiliates': {
|
||||||
|
id: 'footer.edxLinks.affiliates',
|
||||||
|
defaultMessage: 'Affiliates',
|
||||||
|
description: 'The label for the link to the edX affiliates page.',
|
||||||
|
},
|
||||||
|
'footer.edxLinks.openEdx': {
|
||||||
|
id: 'footer.edxLinks.openEdx',
|
||||||
|
defaultMessage: 'Open edX',
|
||||||
|
description: 'The label for the link to the open edX site.',
|
||||||
|
},
|
||||||
|
'footer.edxLinks.careers': {
|
||||||
|
id: 'footer.edxLinks.careers',
|
||||||
|
defaultMessage: 'Careers',
|
||||||
|
description: 'The label for the link to the edX Careers page.',
|
||||||
|
},
|
||||||
|
'footer.edxLinks.news': {
|
||||||
|
id: 'footer.edxLinks.news',
|
||||||
|
defaultMessage: 'News',
|
||||||
|
description: 'The label for the link to the edX news page.',
|
||||||
|
},
|
||||||
|
'footer.legalLinks.heading': {
|
||||||
|
id: 'footer.legalLinks.heading',
|
||||||
|
defaultMessage: 'Legal',
|
||||||
|
description: 'Heading for the legal links section of the footer.',
|
||||||
|
},
|
||||||
|
'footer.legalLinks.termsOfService': {
|
||||||
|
id: 'footer.legalLinks.termsOfService',
|
||||||
|
defaultMessage: 'Terms of Service & Honor Code',
|
||||||
|
description: 'The label for the link to the edX terms of service page.',
|
||||||
|
},
|
||||||
|
'footer.legalLinks.privacyPolicy': {
|
||||||
|
id: 'footer.legalLinks.privacyPolicy',
|
||||||
|
defaultMessage: 'Privacy Policy',
|
||||||
|
description: 'The label for the link to the edX privacy policy page.',
|
||||||
|
},
|
||||||
|
'footer.legalLinks.a11yPolicy': {
|
||||||
|
id: 'footer.legalLinks.a11yPolicy',
|
||||||
|
defaultMessage: 'Accessibility Policy',
|
||||||
|
description: 'The label for the link to the edX accessibility policy page.',
|
||||||
|
},
|
||||||
|
'footer.legalLinks.trademarkPolicy': {
|
||||||
|
id: 'footer.legalLinks.trademarkPolicy',
|
||||||
|
defaultMessage: 'Trademark Policy',
|
||||||
|
description: 'The label for the link to the edX trademark policy page.',
|
||||||
|
},
|
||||||
|
'footer.legalLinks.sitemap': {
|
||||||
|
id: 'footer.legalLinks.sitemap',
|
||||||
|
defaultMessage: 'Sitemap',
|
||||||
|
description: 'The label for the link to the edX sitemap page.',
|
||||||
|
},
|
||||||
|
'footer.connectLinks.heading': {
|
||||||
|
id: 'footer.connectLinks.heading',
|
||||||
|
defaultMessage: 'Connect',
|
||||||
|
description: 'Heading for the connect links section of the footer.',
|
||||||
|
},
|
||||||
|
'footer.connectLinks.blog': {
|
||||||
|
id: 'footer.connectLinks.blog',
|
||||||
|
defaultMessage: 'Blog',
|
||||||
|
description: 'The label for the link to the edX blog.',
|
||||||
|
},
|
||||||
|
'footer.connectLinks.contact': {
|
||||||
|
id: 'footer.connectLinks.contact',
|
||||||
|
defaultMessage: 'Contact Us',
|
||||||
|
description: 'The label for the link to the contact edX page.',
|
||||||
|
},
|
||||||
|
'footer.connectLinks.help': {
|
||||||
|
id: 'footer.connectLinks.help',
|
||||||
|
defaultMessage: 'Help Center',
|
||||||
|
description: 'The label for the link to the edX help center.',
|
||||||
|
},
|
||||||
|
'footer.connectLinks.mediaKit': {
|
||||||
|
id: 'footer.connectLinks.mediaKit',
|
||||||
|
defaultMessage: 'Media Kit',
|
||||||
|
description: 'The label for the link to the edX media kit page.',
|
||||||
|
},
|
||||||
|
'footer.connectLinks.donate': {
|
||||||
|
id: 'footer.connectLinks.donate',
|
||||||
|
defaultMessage: 'Donate',
|
||||||
|
description: 'The label for the link to the edX donation page.',
|
||||||
|
},
|
||||||
|
'footer.mobileApp.apple': {
|
||||||
|
id: 'footer.mobileApp.apple',
|
||||||
|
defaultMessage: 'Download the edX mobile app from the Apple App Store',
|
||||||
|
description: 'The label for the link to download the apple version of the edX app.',
|
||||||
|
},
|
||||||
|
'footer.mobileApp.google': {
|
||||||
|
id: 'footer.mobileApp.google',
|
||||||
|
defaultMessage: 'Download the edX mobile app from Google Play',
|
||||||
|
description: 'The label for the link to download the google version of the edX app.',
|
||||||
|
},
|
||||||
|
'footer.logo.altText': {
|
||||||
|
id: 'footer.logo.altText',
|
||||||
|
defaultMessage: 'Powered by Open edX',
|
||||||
|
description: 'alt text for the footer logo.',
|
||||||
|
},
|
||||||
|
'footer.logo.ariaLabel': {
|
||||||
|
id: 'footer.logo.ariaLabel',
|
||||||
|
defaultMessage: 'edX Home',
|
||||||
|
description: 'aria-label for the footer logo.',
|
||||||
|
},
|
||||||
|
'footer.ariaLabel': {
|
||||||
|
id: 'footer.ariaLabel',
|
||||||
|
defaultMessage: 'Page Footer',
|
||||||
|
description: 'aria-label for the footer component',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default messages;
|
||||||
82
src/components/Footer.test.jsx
Normal file
82
src/components/Footer.test.jsx
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import renderer from 'react-test-renderer';
|
||||||
|
import { mount } from 'enzyme';
|
||||||
|
import { IntlProvider } from '@edx/frontend-i18n';
|
||||||
|
|
||||||
|
import Footer from './Footer';
|
||||||
|
|
||||||
|
describe('<Footer />', () => {
|
||||||
|
describe('renders correctly', () => {
|
||||||
|
it('renders without a language selector', () => {
|
||||||
|
const mockHandleAllTrackEvents = jest.fn();
|
||||||
|
const tree = renderer
|
||||||
|
.create((
|
||||||
|
<IntlProvider locale="en">
|
||||||
|
<Footer handleAllTrackEvents={mockHandleAllTrackEvents} />
|
||||||
|
</IntlProvider>
|
||||||
|
))
|
||||||
|
.toJSON();
|
||||||
|
expect(tree).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
it('renders without a language selector in es', () => {
|
||||||
|
const mockHandleAllTrackEvents = jest.fn();
|
||||||
|
const tree = renderer
|
||||||
|
.create((
|
||||||
|
<IntlProvider locale="es">
|
||||||
|
<Footer handleAllTrackEvents={mockHandleAllTrackEvents} />
|
||||||
|
</IntlProvider>
|
||||||
|
))
|
||||||
|
.toJSON();
|
||||||
|
expect(tree).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
it('renders with a language selector', () => {
|
||||||
|
const mockHandleAllTrackEvents = jest.fn();
|
||||||
|
const tree = renderer
|
||||||
|
.create((
|
||||||
|
<IntlProvider locale="en">
|
||||||
|
<Footer
|
||||||
|
handleAllTrackEvents={mockHandleAllTrackEvents}
|
||||||
|
onLanguageSelected={() => {}}
|
||||||
|
supportedLanguages={[
|
||||||
|
{ label: 'English', value: 'en' },
|
||||||
|
{ label: 'Español', value: 'es' },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</IntlProvider>
|
||||||
|
))
|
||||||
|
.toJSON();
|
||||||
|
expect(tree).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('handles language switching', () => {
|
||||||
|
it('calls onLanguageSelected prop when a language is changed', () => {
|
||||||
|
const mockHandleAllTrackEvents = jest.fn();
|
||||||
|
const mockHandleLanguageSelected = jest.fn();
|
||||||
|
const wrapper = mount((
|
||||||
|
<IntlProvider locale="en">
|
||||||
|
<Footer
|
||||||
|
handleAllTrackEvents={mockHandleAllTrackEvents}
|
||||||
|
onLanguageSelected={mockHandleLanguageSelected}
|
||||||
|
supportedLanguages={[
|
||||||
|
{ label: 'English', value: 'en' },
|
||||||
|
{ label: 'Español', value: 'es' },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</IntlProvider>
|
||||||
|
));
|
||||||
|
|
||||||
|
wrapper.find('form').simulate('submit', {
|
||||||
|
target: {
|
||||||
|
elements: {
|
||||||
|
'site-footer-language-select': {
|
||||||
|
value: 'es',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(mockHandleLanguageSelected).toHaveBeenCalledWith('es');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
59
src/components/LanguageSelector.jsx
Normal file
59
src/components/LanguageSelector.jsx
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { injectIntl, intlShape, FormattedMessage } from '@edx/frontend-i18n';
|
||||||
|
|
||||||
|
const LanguageSelector = ({
|
||||||
|
intl, options, onSubmit, ...props
|
||||||
|
}) => {
|
||||||
|
const handleSubmit = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const languageCode = e.target.elements['site-footer-language-select'].value;
|
||||||
|
onSubmit(languageCode);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<form
|
||||||
|
className="form-inline"
|
||||||
|
onSubmit={handleSubmit}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{/* eslint-disable-next-line jsx-a11y/label-has-for */}
|
||||||
|
<div className="form-group">
|
||||||
|
<label htmlFor="site-footer-language-select" className="d-inline-block m-0">
|
||||||
|
<FormattedMessage
|
||||||
|
id="footer.languageForm.select.label"
|
||||||
|
defaultMessage="Choose Language"
|
||||||
|
description="The label for the laguage select part of the language selection form."
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<select
|
||||||
|
id="site-footer-language-select"
|
||||||
|
className="form-control-sm mx-2"
|
||||||
|
name="site-footer-language-select"
|
||||||
|
defaultValue={intl.locale}
|
||||||
|
>
|
||||||
|
{options.map(({ value, label }) =>
|
||||||
|
<option key={value} value={value}>{label}</option>)}
|
||||||
|
</select>
|
||||||
|
<button className="btn btn-outline-primary btn-sm" type="submit">
|
||||||
|
<FormattedMessage
|
||||||
|
id="footer.languageForm.submit.label"
|
||||||
|
defaultMessage="Apply"
|
||||||
|
description="The label for button to submit the language selection form."
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
LanguageSelector.propTypes = {
|
||||||
|
intl: intlShape.isRequired,
|
||||||
|
onSubmit: PropTypes.func.isRequired,
|
||||||
|
options: PropTypes.arrayOf(PropTypes.shape({
|
||||||
|
value: PropTypes.string,
|
||||||
|
label: PropTypes.string,
|
||||||
|
})).isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default injectIntl(LanguageSelector);
|
||||||
136
src/components/__snapshots__/Footer.test.jsx.snap
Normal file
136
src/components/__snapshots__/Footer.test.jsx.snap
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`<Footer /> renders correctly renders with a language selector 1`] = `
|
||||||
|
<footer
|
||||||
|
aria-label="edX Home"
|
||||||
|
className="footer d-flex border-top py-3 px-4"
|
||||||
|
role="contentinfo"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="container d-flex"
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
aria-label="edX Home"
|
||||||
|
className="d-block mb-3"
|
||||||
|
href="https://open.edx.org"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
alt="Powered by Open edX"
|
||||||
|
src="test-file-stub"
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"maxWidth": 150,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
<div
|
||||||
|
className="flex-grow-1"
|
||||||
|
/>
|
||||||
|
<form
|
||||||
|
className="form-inline"
|
||||||
|
onSubmit={[Function]}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="form-group"
|
||||||
|
>
|
||||||
|
<label
|
||||||
|
className="d-inline-block m-0"
|
||||||
|
htmlFor="site-footer-language-select"
|
||||||
|
>
|
||||||
|
<span>
|
||||||
|
Choose Language
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
<select
|
||||||
|
className="form-control-sm mx-2"
|
||||||
|
defaultValue="en"
|
||||||
|
id="site-footer-language-select"
|
||||||
|
name="site-footer-language-select"
|
||||||
|
>
|
||||||
|
<option
|
||||||
|
value="en"
|
||||||
|
>
|
||||||
|
English
|
||||||
|
</option>
|
||||||
|
<option
|
||||||
|
value="es"
|
||||||
|
>
|
||||||
|
Español
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<button
|
||||||
|
className="btn btn-outline-primary btn-sm"
|
||||||
|
type="submit"
|
||||||
|
>
|
||||||
|
<span>
|
||||||
|
Apply
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`<Footer /> renders correctly renders without a language selector 1`] = `
|
||||||
|
<footer
|
||||||
|
aria-label="edX Home"
|
||||||
|
className="footer d-flex border-top py-3 px-4"
|
||||||
|
role="contentinfo"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="container d-flex"
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
aria-label="edX Home"
|
||||||
|
className="d-block mb-3"
|
||||||
|
href="https://open.edx.org"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
alt="Powered by Open edX"
|
||||||
|
src="test-file-stub"
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"maxWidth": 150,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
<div
|
||||||
|
className="flex-grow-1"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`<Footer /> renders correctly renders without a language selector in es 1`] = `
|
||||||
|
<footer
|
||||||
|
aria-label="edX Home"
|
||||||
|
className="footer d-flex border-top py-3 px-4"
|
||||||
|
role="contentinfo"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="container d-flex"
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
aria-label="edX Home"
|
||||||
|
className="d-block mb-3"
|
||||||
|
href="https://open.edx.org"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
alt="Powered by Open edX"
|
||||||
|
src="test-file-stub"
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"maxWidth": 150,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
<div
|
||||||
|
className="flex-grow-1"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
`;
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.0 KiB |
BIN
src/edx-openedx-logo-tag.png
Normal file
BIN
src/edx-openedx-logo-tag.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
32
src/i18n/index.js
Normal file
32
src/i18n/index.js
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import arMessages from './messages/ar.json';
|
||||||
|
import caMessages from './messages/ca.json';
|
||||||
|
// no need to import en messages-- they are in the defaultMessage field
|
||||||
|
import es419Messages from './messages/es_419.json';
|
||||||
|
import frMessages from './messages/fr.json';
|
||||||
|
import zhcnMessages from './messages/zh_CN.json';
|
||||||
|
import heMessages from './messages/he.json';
|
||||||
|
import idMessages from './messages/id.json';
|
||||||
|
import kokrMessages from './messages/ko_kr.json';
|
||||||
|
import plMessages from './messages/pl.json';
|
||||||
|
import ptbrMessages from './messages/pt_br.json';
|
||||||
|
import ruMessages from './messages/ru.json';
|
||||||
|
import thMessages from './messages/th.json';
|
||||||
|
import ukMessages from './messages/uk.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
ar: arMessages,
|
||||||
|
'es-419': es419Messages,
|
||||||
|
fr: frMessages,
|
||||||
|
'zh-cn': zhcnMessages,
|
||||||
|
ca: caMessages,
|
||||||
|
he: heMessages,
|
||||||
|
id: idMessages,
|
||||||
|
'ko-kr': kokrMessages,
|
||||||
|
pl: plMessages,
|
||||||
|
'pt-br': ptbrMessages,
|
||||||
|
ru: ruMessages,
|
||||||
|
th: thMessages,
|
||||||
|
uk: ukMessages,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default messages;
|
||||||
1
src/i18n/messages/ar.json
Normal file
1
src/i18n/messages/ar.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
1
src/i18n/messages/ca.json
Normal file
1
src/i18n/messages/ca.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
1
src/i18n/messages/es_419.json
Normal file
1
src/i18n/messages/es_419.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
1
src/i18n/messages/fr.json
Normal file
1
src/i18n/messages/fr.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
1
src/i18n/messages/he.json
Normal file
1
src/i18n/messages/he.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
1
src/i18n/messages/id.json
Normal file
1
src/i18n/messages/id.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
1
src/i18n/messages/ko_kr.json
Normal file
1
src/i18n/messages/ko_kr.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
1
src/i18n/messages/pl.json
Normal file
1
src/i18n/messages/pl.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
1
src/i18n/messages/pt_br.json
Normal file
1
src/i18n/messages/pt_br.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
1
src/i18n/messages/ru.json
Normal file
1
src/i18n/messages/ru.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
1
src/i18n/messages/th.json
Normal file
1
src/i18n/messages/th.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
1
src/i18n/messages/uk.json
Normal file
1
src/i18n/messages/uk.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
1
src/i18n/messages/zh_CN.json
Normal file
1
src/i18n/messages/zh_CN.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
5
src/index.js
Normal file
5
src/index.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import Footer, { EVENT_NAMES } from './components/Footer';
|
||||||
|
import messages from './i18n/index';
|
||||||
|
|
||||||
|
export default Footer;
|
||||||
|
export { messages, EVENT_NAMES };
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { render } from 'react-dom';
|
|
||||||
import SiteFooter from './lib';
|
|
||||||
import './index.scss';
|
|
||||||
|
|
||||||
import FooterLogo from './edx-footer.png';
|
|
||||||
|
|
||||||
const App = () => (
|
|
||||||
<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"
|
|
||||||
facebookUrl="https://www.facebook.com"
|
|
||||||
twitterUrl="https://www.twitter.com"
|
|
||||||
youTubeUrl="https://www.youtube.com"
|
|
||||||
linkedInUrl="https://www.linkedin.com"
|
|
||||||
googlePlusUrl="https://plus.google.com"
|
|
||||||
redditUrl="https://reddit.com"
|
|
||||||
appleAppStoreUrl="https://store.apple.com"
|
|
||||||
googlePlayUrl="https://play.google.com"
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
||||||
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';
|
|
||||||
@@ -1,112 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import renderer from 'react-test-renderer';
|
|
||||||
import { mount } from 'enzyme';
|
|
||||||
|
|
||||||
import FooterLogo from '../../../edx-footer.png';
|
|
||||||
import SiteFooter, { EVENT_NAMES } from './index';
|
|
||||||
|
|
||||||
const completeSiteFooterComponent = mockHandleAllTrackEvents =>
|
|
||||||
(<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"
|
|
||||||
facebookUrl="https://www.facebook.com"
|
|
||||||
twitterUrl="https://www.twitter.com"
|
|
||||||
youTubeUrl="https://www.youtube.com"
|
|
||||||
linkedInUrl="https://www.linkedin.com"
|
|
||||||
googlePlusUrl="https://plus.google.com"
|
|
||||||
redditUrl="https://reddit.com"
|
|
||||||
appleAppStoreUrl="https://store.apple.com"
|
|
||||||
googlePlayUrl="https://play.google.com"
|
|
||||||
handleAllTrackEvents={mockHandleAllTrackEvents}
|
|
||||||
/>);
|
|
||||||
|
|
||||||
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
|
|
||||||
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"
|
|
||||||
facebookUrl="https://www.facebook.com"
|
|
||||||
twitterUrl="https://www.twitter.com"
|
|
||||||
youTubeUrl="https://www.youtube.com"
|
|
||||||
linkedInUrl="https://www.linkedin.com"
|
|
||||||
googlePlusUrl="https://plus.google.com"
|
|
||||||
redditUrl="https://reddit.com"
|
|
||||||
appleAppStoreUrl="https://store.apple.com"
|
|
||||||
googlePlayUrl="https://play.google.com"
|
|
||||||
handleAllTrackEvents={jest.fn()}
|
|
||||||
showSocialLinks={false}
|
|
||||||
/>)
|
|
||||||
.toJSON();
|
|
||||||
expect(tree).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('does not render mobile links', () => {
|
|
||||||
const tree = renderer
|
|
||||||
.create(<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"
|
|
||||||
facebookUrl="https://www.facebook.com"
|
|
||||||
twitterUrl="https://www.twitter.com"
|
|
||||||
youTubeUrl="https://www.youtube.com"
|
|
||||||
linkedInUrl="https://www.linkedin.com"
|
|
||||||
googlePlusUrl="https://plus.google.com"
|
|
||||||
redditUrl="https://reddit.com"
|
|
||||||
appleAppStoreUrl="https://store.apple.com"
|
|
||||||
googlePlayUrl="https://play.google.com"
|
|
||||||
handleAllTrackEvents={jest.fn()}
|
|
||||||
showMobileLinks={false}
|
|
||||||
/>)
|
|
||||||
.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,877 +0,0 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
||||||
|
|
||||||
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="example Home"
|
|
||||||
href="https://www.example.com/"
|
|
||||||
onClick={[Function]}
|
|
||||||
target="_self"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
alt="example logo"
|
|
||||||
src="test-file-stub"
|
|
||||||
/>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
className="area-2"
|
|
||||||
>
|
|
||||||
<h2>
|
|
||||||
example
|
|
||||||
</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://www.example.com/enterprise"
|
|
||||||
>
|
|
||||||
example
|
|
||||||
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
|
|
||||||
example
|
|
||||||
</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"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
aria-hidden={true}
|
|
||||||
className="fa fa-facebook-square fa-2x"
|
|
||||||
id="Icon1"
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
className="sr-only"
|
|
||||||
>
|
|
||||||
Like example on Facebook
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://www.twitter.com"
|
|
||||||
onClick={[Function]}
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
title="Twitter"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
aria-hidden={true}
|
|
||||||
className="fa fa-twitter-square fa-2x"
|
|
||||||
id="Icon1"
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
className="sr-only"
|
|
||||||
>
|
|
||||||
Follow example on Twitter
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://www.youtube.com"
|
|
||||||
onClick={[Function]}
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
title="Youtube"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
aria-hidden={true}
|
|
||||||
className="fa fa-youtube-square fa-2x"
|
|
||||||
id="Icon1"
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
className="sr-only"
|
|
||||||
>
|
|
||||||
Subscribe to the example YouTube channel
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://www.linkedin.com"
|
|
||||||
onClick={[Function]}
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
title="LinkedIn"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
aria-hidden={true}
|
|
||||||
className="fa fa-linkedin-square fa-2x"
|
|
||||||
id="Icon1"
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
className="sr-only"
|
|
||||||
>
|
|
||||||
Follow example on LinkedIn
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://plus.google.com"
|
|
||||||
onClick={[Function]}
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
title="Google+"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
aria-hidden={true}
|
|
||||||
className="fa fa-google-plus-square fa-2x"
|
|
||||||
id="Icon1"
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
className="sr-only"
|
|
||||||
>
|
|
||||||
Follow example on Google+
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://reddit.com"
|
|
||||||
onClick={[Function]}
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
title="Reddit"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
aria-hidden={true}
|
|
||||||
className="fa fa-reddit-square fa-2x"
|
|
||||||
id="Icon1"
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
className="sr-only"
|
|
||||||
>
|
|
||||||
Subscribe to the example subreddit
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<p>
|
|
||||||
© 2012–
|
|
||||||
2019
|
|
||||||
|
|
||||||
example
|
|
||||||
Inc.
|
|
||||||
<br />
|
|
||||||
EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | 粤ICP备17044299号-2
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`<SiteFooter /> renders correctly does not render social links 1`] = `
|
|
||||||
<footer
|
|
||||||
aria-label="Page Footer"
|
|
||||||
className="footer d-flex justify-content-center border-top py-3 px-4"
|
|
||||||
role="contentinfo"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="max-width-1180 d-grid"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="area-1"
|
|
||||||
>
|
|
||||||
<a
|
|
||||||
aria-label="example Home"
|
|
||||||
href="https://www.example.com/"
|
|
||||||
onClick={[Function]}
|
|
||||||
target="_self"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
alt="example logo"
|
|
||||||
src="test-file-stub"
|
|
||||||
/>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
className="area-2"
|
|
||||||
>
|
|
||||||
<h2>
|
|
||||||
example
|
|
||||||
</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://www.example.com/enterprise"
|
|
||||||
>
|
|
||||||
example
|
|
||||||
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
|
|
||||||
example
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://www.example.com/careers"
|
|
||||||
>
|
|
||||||
Careers
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://www.example.com/news-announcements"
|
|
||||||
>
|
|
||||||
News
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
className="area-3"
|
|
||||||
>
|
|
||||||
<h2>
|
|
||||||
Legal
|
|
||||||
</h2>
|
|
||||||
<ul
|
|
||||||
className="list-unstyled p-0 m-0"
|
|
||||||
>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://www.example.com/terms-of-service"
|
|
||||||
>
|
|
||||||
Terms of Service & Honor Code
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://www.example.com/privacy-policy"
|
|
||||||
>
|
|
||||||
Privacy Policy
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://www.example.com/accessibility"
|
|
||||||
>
|
|
||||||
Accessibility Policy
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://www.example.com/trademarks"
|
|
||||||
>
|
|
||||||
Trademark Policy
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://www.example.com/sitemap"
|
|
||||||
>
|
|
||||||
Sitemap
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
className="area-4"
|
|
||||||
>
|
|
||||||
<h2>
|
|
||||||
Connect
|
|
||||||
</h2>
|
|
||||||
<ul
|
|
||||||
className="list-unstyled p-0 m-0"
|
|
||||||
>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://www.example.com/blog"
|
|
||||||
>
|
|
||||||
Blog
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://www.example.com/contact"
|
|
||||||
>
|
|
||||||
Contact Us
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://www.example.com/support"
|
|
||||||
>
|
|
||||||
Help Center
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://www.example.com/media-kit"
|
|
||||||
>
|
|
||||||
Media Kit
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://www.example.com/donate"
|
|
||||||
>
|
|
||||||
Donate
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
className="area-5"
|
|
||||||
>
|
|
||||||
<ul
|
|
||||||
className="d-flex flex-row justify-content-between list-unstyled max-width-264 p-0 mb-5"
|
|
||||||
>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://store.apple.com"
|
|
||||||
onClick={[Function]}
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
alt="Download the example 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 example 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
|
|
||||||
|
|
||||||
example
|
|
||||||
Inc.
|
|
||||||
<br />
|
|
||||||
EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | 粤ICP备17044299号-2
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`<SiteFooter /> renders correctly renders with social and mobile links 1`] = `
|
|
||||||
<footer
|
|
||||||
aria-label="Page Footer"
|
|
||||||
className="footer d-flex justify-content-center border-top py-3 px-4"
|
|
||||||
role="contentinfo"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="max-width-1180 d-grid"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="area-1"
|
|
||||||
>
|
|
||||||
<a
|
|
||||||
aria-label="example Home"
|
|
||||||
href="https://www.example.com/"
|
|
||||||
onClick={[Function]}
|
|
||||||
target="_self"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
alt="example logo"
|
|
||||||
src="test-file-stub"
|
|
||||||
/>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
className="area-2"
|
|
||||||
>
|
|
||||||
<h2>
|
|
||||||
example
|
|
||||||
</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://www.example.com/enterprise"
|
|
||||||
>
|
|
||||||
example
|
|
||||||
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
|
|
||||||
example
|
|
||||||
</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"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
aria-hidden={true}
|
|
||||||
className="fa fa-facebook-square fa-2x"
|
|
||||||
id="Icon1"
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
className="sr-only"
|
|
||||||
>
|
|
||||||
Like example on Facebook
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://www.twitter.com"
|
|
||||||
onClick={[Function]}
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
title="Twitter"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
aria-hidden={true}
|
|
||||||
className="fa fa-twitter-square fa-2x"
|
|
||||||
id="Icon1"
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
className="sr-only"
|
|
||||||
>
|
|
||||||
Follow example on Twitter
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://www.youtube.com"
|
|
||||||
onClick={[Function]}
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
title="Youtube"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
aria-hidden={true}
|
|
||||||
className="fa fa-youtube-square fa-2x"
|
|
||||||
id="Icon1"
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
className="sr-only"
|
|
||||||
>
|
|
||||||
Subscribe to the example YouTube channel
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://www.linkedin.com"
|
|
||||||
onClick={[Function]}
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
title="LinkedIn"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
aria-hidden={true}
|
|
||||||
className="fa fa-linkedin-square fa-2x"
|
|
||||||
id="Icon1"
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
className="sr-only"
|
|
||||||
>
|
|
||||||
Follow example on LinkedIn
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://plus.google.com"
|
|
||||||
onClick={[Function]}
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
title="Google+"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
aria-hidden={true}
|
|
||||||
className="fa fa-google-plus-square fa-2x"
|
|
||||||
id="Icon1"
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
className="sr-only"
|
|
||||||
>
|
|
||||||
Follow example on Google+
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="https://reddit.com"
|
|
||||||
onClick={[Function]}
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
title="Reddit"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
aria-hidden={true}
|
|
||||||
className="fa fa-reddit-square fa-2x"
|
|
||||||
id="Icon1"
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
className="sr-only"
|
|
||||||
>
|
|
||||||
Subscribe to the example 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 example 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 example 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
|
|
||||||
|
|
||||||
example
|
|
||||||
Inc.
|
|
||||||
<br />
|
|
||||||
EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | 粤ICP备17044299号-2
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
`;
|
|
||||||
@@ -1,273 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { Hyperlink, Icon } from '@edx/paragon';
|
|
||||||
|
|
||||||
const EVENT_NAMES = {
|
|
||||||
FOOTER_LINK: 'edx.bi.footer.link',
|
|
||||||
};
|
|
||||||
|
|
||||||
class SiteFooter extends React.Component {
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
this.externalLinkClickHandler = this.externalLinkClickHandler.bind(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
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.siteName} logo`} />
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
renderMarketingSiteUrl(path) {
|
|
||||||
return `${this.props.marketingSiteBaseUrl}${path}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
renderSocialLinks() {
|
|
||||||
const {
|
|
||||||
siteName,
|
|
||||||
showSocialLinks,
|
|
||||||
facebookUrl,
|
|
||||||
twitterUrl,
|
|
||||||
youTubeUrl,
|
|
||||||
linkedInUrl,
|
|
||||||
googlePlusUrl,
|
|
||||||
redditUrl,
|
|
||||||
} = this.props;
|
|
||||||
let socialLinks = null;
|
|
||||||
if (showSocialLinks) {
|
|
||||||
socialLinks = (
|
|
||||||
<ul
|
|
||||||
className="d-flex flex-row justify-content-between list-unstyled max-width-222 p-0 mb-4"
|
|
||||||
>
|
|
||||||
{/* TODO: Use Paragon HyperLink with Icon. */}
|
|
||||||
{/* Would need to add rel to paragon if we still need it. */}
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href={facebookUrl}
|
|
||||||
title="Facebook"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
onClick={this.externalLinkClickHandler}
|
|
||||||
>
|
|
||||||
<Icon className={['fa', 'fa-facebook-square', 'fa-2x']} screenReaderText={`Like ${siteName} on Facebook`} />
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href={twitterUrl}
|
|
||||||
title="Twitter"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
onClick={this.externalLinkClickHandler}
|
|
||||||
>
|
|
||||||
<Icon className={['fa', 'fa-twitter-square', 'fa-2x']} screenReaderText={`Follow ${siteName} on Twitter`} />
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href={youTubeUrl}
|
|
||||||
title="Youtube"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
onClick={this.externalLinkClickHandler}
|
|
||||||
>
|
|
||||||
<Icon className={['fa', 'fa-youtube-square', 'fa-2x']} screenReaderText={`Subscribe to the ${siteName} YouTube channel`} />
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href={linkedInUrl}
|
|
||||||
title="LinkedIn"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
onClick={this.externalLinkClickHandler}
|
|
||||||
>
|
|
||||||
<Icon className={['fa', 'fa-linkedin-square', 'fa-2x']} screenReaderText={`Follow ${siteName} on LinkedIn`} />
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href={googlePlusUrl}
|
|
||||||
title="Google+"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
onClick={this.externalLinkClickHandler}
|
|
||||||
>
|
|
||||||
<Icon className={['fa', 'fa-google-plus-square', 'fa-2x']} screenReaderText={`Follow ${siteName} on Google+`} />
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href={redditUrl}
|
|
||||||
title="Reddit"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
target="_blank"
|
|
||||||
onClick={this.externalLinkClickHandler}
|
|
||||||
>
|
|
||||||
<Icon className={['fa', 'fa-reddit-square', 'fa-2x']} screenReaderText={`Subscribe to the ${siteName} subreddit`} />
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return socialLinks;
|
|
||||||
}
|
|
||||||
|
|
||||||
renderMobileLinks() {
|
|
||||||
const {
|
|
||||||
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={`Download the ${siteName} mobile app from the Apple App Store`}
|
|
||||||
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={`Download the ${siteName} mobile app from Google Play`}
|
|
||||||
src="https://prod-edxapp.edx-cdn.org/static/images/app/google_play_badge_45.6ea466e328da.png"
|
|
||||||
/>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return mobileLinks;
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
siteName,
|
|
||||||
openSourceUrl,
|
|
||||||
termsOfServiceUrl,
|
|
||||||
privacyPolicyUrl,
|
|
||||||
contactUrl,
|
|
||||||
supportUrl,
|
|
||||||
} = this.props;
|
|
||||||
return (
|
|
||||||
<footer
|
|
||||||
role="contentinfo"
|
|
||||||
aria-label="Page Footer"
|
|
||||||
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={`${siteName} Home`} />
|
|
||||||
</div>
|
|
||||||
<div className="area-2">
|
|
||||||
<h2>{siteName}</h2>
|
|
||||||
<ul className="list-unstyled p-0 m-0">
|
|
||||||
<li><a href={this.renderMarketingSiteUrl('/about-us')}>About</a></li>
|
|
||||||
<li><a href={this.renderMarketingSiteUrl('/enterprise')}>{siteName} for Business</a></li>
|
|
||||||
<li><a href={this.renderMarketingSiteUrl('/affiliate-program')}>Affiliates</a></li>
|
|
||||||
<li><a href={openSourceUrl}>Open {siteName}</a></li>
|
|
||||||
<li><a href={this.renderMarketingSiteUrl('/careers')}>Careers</a></li>
|
|
||||||
<li><a href={this.renderMarketingSiteUrl('/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={termsOfServiceUrl}>Terms of Service & Honor Code</a></li>
|
|
||||||
<li><a href={privacyPolicyUrl}>Privacy Policy</a></li>
|
|
||||||
<li><a href={this.renderMarketingSiteUrl('/accessibility')}>Accessibility Policy</a></li>
|
|
||||||
<li><a href={this.renderMarketingSiteUrl('/trademarks')}>Trademark Policy</a></li>
|
|
||||||
<li><a href={this.renderMarketingSiteUrl('/sitemap')}>Sitemap</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div className="area-4">
|
|
||||||
<h2>Connect</h2>
|
|
||||||
<ul className="list-unstyled p-0 m-0">
|
|
||||||
<li><a href={this.renderMarketingSiteUrl('/blog')}>Blog</a></li>
|
|
||||||
<li><a href={contactUrl}>Contact Us</a></li>
|
|
||||||
<li><a href={supportUrl}>Help Center</a></li>
|
|
||||||
<li><a href={this.renderMarketingSiteUrl('/media-kit')}>Media Kit</a></li>
|
|
||||||
<li><a href={this.renderMarketingSiteUrl('/donate')}>Donate</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div className="area-5">
|
|
||||||
{this.renderSocialLinks()}
|
|
||||||
{this.renderMobileLinks()}
|
|
||||||
<p>
|
|
||||||
© 2012–{(new Date().getFullYear())} {siteName} Inc.
|
|
||||||
<br />
|
|
||||||
EdX, Open edX, and MicroMasters are registered trademarks of edX Inc.
|
|
||||||
| 粤ICP备17044299号-2
|
|
||||||
</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,
|
|
||||||
showSocialLinks: PropTypes.bool,
|
|
||||||
facebookUrl: PropTypes.string,
|
|
||||||
twitterUrl: PropTypes.string,
|
|
||||||
youTubeUrl: PropTypes.string,
|
|
||||||
linkedInUrl: PropTypes.string,
|
|
||||||
googlePlusUrl: PropTypes.string,
|
|
||||||
redditUrl: PropTypes.string,
|
|
||||||
showMobileLinks: PropTypes.bool,
|
|
||||||
appleAppStoreUrl: PropTypes.string,
|
|
||||||
googlePlayUrl: PropTypes.string,
|
|
||||||
handleAllTrackEvents: PropTypes.func.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
SiteFooter.defaultProps = {
|
|
||||||
siteName: null,
|
|
||||||
siteLogo: null,
|
|
||||||
marketingSiteBaseUrl: null,
|
|
||||||
supportUrl: null,
|
|
||||||
contactUrl: null,
|
|
||||||
openSourceUrl: null,
|
|
||||||
termsOfServiceUrl: null,
|
|
||||||
privacyPolicyUrl: null,
|
|
||||||
showSocialLinks: true,
|
|
||||||
facebookUrl: null,
|
|
||||||
twitterUrl: null,
|
|
||||||
youTubeUrl: null,
|
|
||||||
linkedInUrl: null,
|
|
||||||
googlePlusUrl: null,
|
|
||||||
redditUrl: null,
|
|
||||||
showMobileLinks: true,
|
|
||||||
appleAppStoreUrl: null,
|
|
||||||
googlePlayUrl: null,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default SiteFooter;
|
|
||||||
export { EVENT_NAMES };
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
import SiteFooter from './components/SiteFooter';
|
|
||||||
|
|
||||||
export default SiteFooter;
|
|
||||||
@@ -1,165 +0,0 @@
|
|||||||
.max-width-222 {
|
|
||||||
max-width: 222px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.max-width-264 {
|
|
||||||
max-width: 264px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.max-width-1180 {
|
|
||||||
max-width: 1180px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.max-height-39 {
|
|
||||||
max-height: 39px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.d-grid {
|
|
||||||
display: grid;
|
|
||||||
}
|
|
||||||
|
|
||||||
$gray-footer: #fcfcfc;
|
|
||||||
$border-1: 1px solid $gray-200;
|
|
||||||
|
|
||||||
.footer {
|
|
||||||
background-color: $gray-footer;
|
|
||||||
|
|
||||||
.area-1 {
|
|
||||||
grid-column: 1;
|
|
||||||
grid-row: 1;
|
|
||||||
border-bottom: $border-1;
|
|
||||||
padding-bottom: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-2 {
|
|
||||||
grid-column: 1;
|
|
||||||
grid-row: 2;
|
|
||||||
border-bottom: $border-1;
|
|
||||||
padding: 1rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-3 {
|
|
||||||
grid-column: 1;
|
|
||||||
grid-row: 3;
|
|
||||||
border-bottom: $border-1;
|
|
||||||
padding: 1rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-4 {
|
|
||||||
grid-column: 1;
|
|
||||||
grid-row: 4;
|
|
||||||
border-bottom: $border-1;
|
|
||||||
padding: 1rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-5 {
|
|
||||||
grid-column: 1;
|
|
||||||
grid-row: 5;
|
|
||||||
padding: 1rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media only screen and (min-width: 717px) {
|
|
||||||
.area-1 {
|
|
||||||
grid-column: 1 / span 2;
|
|
||||||
grid-row: 1;
|
|
||||||
border-bottom: none;
|
|
||||||
padding: 1rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-2 {
|
|
||||||
grid-column: 1;
|
|
||||||
grid-row: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-3 {
|
|
||||||
grid-column: 1;
|
|
||||||
grid-row: 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-4 {
|
|
||||||
grid-column: 1;
|
|
||||||
grid-row: 4;
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-5 {
|
|
||||||
grid-column: 2;
|
|
||||||
grid-row: 2 / span 3;
|
|
||||||
border-left: $border-1;
|
|
||||||
padding-left: 1rem;
|
|
||||||
margin-left: 1rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media only screen and (min-width: 870px) {
|
|
||||||
.area-1 {
|
|
||||||
grid-column: 1;
|
|
||||||
grid-row: 1 / span 3;
|
|
||||||
border-right: $border-1;
|
|
||||||
padding-right: 1rem;
|
|
||||||
margin-right: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-2 {
|
|
||||||
grid-column: 2;
|
|
||||||
grid-row: 1;
|
|
||||||
border-bottom: none;
|
|
||||||
border-right: $border-1;
|
|
||||||
padding-right: 1rem;
|
|
||||||
margin-right: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-3 {
|
|
||||||
grid-column: 3;
|
|
||||||
grid-row: 1;
|
|
||||||
border-bottom: none;
|
|
||||||
border-right: $border-1;
|
|
||||||
padding-right: 1rem;
|
|
||||||
margin-right: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-4 {
|
|
||||||
grid-column: 4;
|
|
||||||
grid-row: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-5 {
|
|
||||||
grid-column: 2 / span 3;
|
|
||||||
grid-row: 2;
|
|
||||||
border: none;
|
|
||||||
margin-left: 0;
|
|
||||||
padding-left: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media only screen and (min-width: 1188px) {
|
|
||||||
.area-1 {
|
|
||||||
grid-column: 1 / span 1;
|
|
||||||
grid-row: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-2 {
|
|
||||||
grid-column: 2;
|
|
||||||
grid-row: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-3 {
|
|
||||||
grid-column: 3;
|
|
||||||
grid-row: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-4 {
|
|
||||||
grid-column: 4;
|
|
||||||
grid-row: 1;
|
|
||||||
border-right: $border-1;
|
|
||||||
padding-right: 1rem;
|
|
||||||
margin-right: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-5 {
|
|
||||||
grid-column: 5 / span 1;
|
|
||||||
grid-row: 1;
|
|
||||||
max-width: 372px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
1275
stats.json
Normal file
1275
stats.json
Normal file
File diff suppressed because one or more lines are too long
10
webpack.dev.config.js
Normal file
10
webpack.dev.config.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
const path = require('path');
|
||||||
|
const { createConfig } = require('@edx/frontend-build');
|
||||||
|
|
||||||
|
module.exports = createConfig('webpack-dev', {
|
||||||
|
entry: path.resolve(__dirname, 'example'),
|
||||||
|
output: {
|
||||||
|
path: path.resolve(__dirname, 'example/dist'),
|
||||||
|
publicPath: '/',
|
||||||
|
},
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user