fix: remove old views (#36677)

This commit is contained in:
Ahmad Abdolsaheb
2019-08-30 12:54:01 +03:00
committed by mrugesh
parent e9d753fc09
commit f8a603d182
25 changed files with 689 additions and 1462 deletions

View File

@@ -0,0 +1,13 @@
/* global expect */
import React from 'react';
import renderer from 'react-test-renderer';
import 'jest-dom/extend-expect';
import Footer from './';
describe('<Footer />', () => {
it('renders to the DOM', () => {
const tree = renderer.create(<Footer />).toJSON();
expect(tree).toMatchSnapshot();
});
});

View File

@@ -0,0 +1,41 @@
import React from 'react';
import PropTypes from 'prop-types';
import Link from '../helpers/Link';
import { footerLinks } from './footerLinks';
import './footer.css';
function FooterCol({ colNum, title }) {
// if the column number is not applicable return an empty div
if (colNum < 1 || colNum > footerLinks + 1) return <div></div>;
let linksRow = footerLinks[colNum - 1].map(function(item, i) {
if (item.interal)
return (
<Link key={i} to={item.to}>
{item.text}
</Link>
);
return (
<Link external={true} key={i} to={item.to}>
{item.text}
</Link>
);
});
return (
<div className={`footer-col-${colNum}`}>
<div className='col-header'>{title}</div>
{linksRow}
</div>
);
}
const propTypes = {
colNum: PropTypes.number,
title: PropTypes.string
};
FooterCol.propTypes = propTypes;
FooterCol.displayName = 'FooterCol';
export default FooterCol;

View File

@@ -0,0 +1,408 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<Footer /> renders to the DOM 1`] = `
<footer
className="site-footer"
>
<div
className="footer-container"
>
<div
className="footer-row"
>
<div
className="footer-desc-col"
>
<p>
freeCodeCamp is a donor-supported tax-exempt 501(c)(3) nonprofit organization (United States Federal Tax Identification Number: 82-0779546)
</p>
<p>
Our mission: to help people learn to code for free. We accomplish this by creating thousands of videos, articles, and interactive coding lessons - all freely available to the public. We also have thousands of freeCodeCamp study groups around the world.
</p>
<p>
Donations to freeCodeCamp go toward our education initiatives, and help pay for servers, services, and staff. You can 
<a
className="inline"
href="/donate"
>
make a tax-deductible donation here
</a>
.
</p>
</div>
<div
className="footer-col-1"
>
<div
className="col-header"
>
Our Nonprofit
</div>
<a
href="/news/about/"
rel="noopener noreferrer"
target="_blank"
>
About
</a>
<a
href="/donate"
rel="noopener noreferrer"
target="_blank"
>
Donate
</a>
<a
href="/news/shop/"
rel="noopener noreferrer"
target="_blank"
>
Shop
</a>
<a
href="https://www.linkedin.com/school/free-code-camp/people/"
rel="noopener noreferrer"
target="_blank"
>
Alumni Network
</a>
<a
href="https://github.com/freeCodeCamp/"
rel="noopener noreferrer"
target="_blank"
>
Open Source
</a>
<a
href="/news/support/"
rel="noopener noreferrer"
target="_blank"
>
Support
</a>
<a
href="/news/sponsors/"
rel="noopener noreferrer"
target="_blank"
>
Sponsors
</a>
<a
href="/news/academic-honesty-policy/"
rel="noopener noreferrer"
target="_blank"
>
Academic Honesty
</a>
<a
href="/news/code-of-conduct/"
rel="noopener noreferrer"
target="_blank"
>
Code of Conduct
</a>
<a
href="/news/privacy-policy/"
rel="noopener noreferrer"
target="_blank"
>
Privacy Policy
</a>
<a
href="/news/terms-of-service/"
rel="noopener noreferrer"
target="_blank"
>
Terms of Service
</a>
<a
href="/news/copyright-policy/"
rel="noopener noreferrer"
target="_blank"
>
Copyright Policy
</a>
</div>
<div
className="footer-col-2"
>
<div
className="col-header"
>
Best Tutorials
</div>
<a
href="/news/best-python-tutorial/"
rel="noopener noreferrer"
target="_blank"
>
Python Tutorial
</a>
<a
href="/news/best-git-tutorial/"
rel="noopener noreferrer"
target="_blank"
>
Git Tutorial
</a>
<a
href="/news/the-best-linux-tutorials/"
rel="noopener noreferrer"
target="_blank"
>
Linux Tutorial
</a>
<a
href="/news/best-javascript-tutorial/"
rel="noopener noreferrer"
target="_blank"
>
JavaScript Tutorial
</a>
<a
href="/news/best-react-javascript-tutorial/"
rel="noopener noreferrer"
target="_blank"
>
React Tutorial
</a>
<a
href="/news/best-html-html5-tutorial/"
rel="noopener noreferrer"
target="_blank"
>
HTML Tutorial
</a>
<a
href="/news/best-css-and-css3-tutorial/"
rel="noopener noreferrer"
target="_blank"
>
CSS Tutorial
</a>
<a
href="/news/best-sql-database-tutorial/"
rel="noopener noreferrer"
target="_blank"
>
SQL Tutorial
</a>
<a
href="/news/best-java-8-tutorial/"
rel="noopener noreferrer"
target="_blank"
>
Java Tutorial
</a>
<a
href="/news/best-angular-tutorial-angularjs/"
rel="noopener noreferrer"
target="_blank"
>
Angular Tutorial
</a>
<a
href="/news/best-wordpress-tutorial/"
rel="noopener noreferrer"
target="_blank"
>
WordPress Tutorial
</a>
<a
href="/news/best-bootstrap-tutorial-responsive-web-design/"
rel="noopener noreferrer"
target="_blank"
>
Bootstrap Tutorial
</a>
</div>
<div
className="footer-col-3"
>
<div
className="col-header"
>
Best Examples
</div>
<a
href="/news/python-example/"
rel="noopener noreferrer"
target="_blank"
>
Python Example
</a>
<a
href="/news/javascript-example/"
rel="noopener noreferrer"
target="_blank"
>
JavaScript Example
</a>
<a
href="/news/react-examples-reactjs/"
rel="noopener noreferrer"
target="_blank"
>
React Example
</a>
<a
href="/news/linux-example-bash-command-line/"
rel="noopener noreferrer"
target="_blank"
>
Linux Example
</a>
<a
href="/news/html-and-html5-example/"
rel="noopener noreferrer"
target="_blank"
>
HTML Example
</a>
<a
href="/news/css-example-css3/"
rel="noopener noreferrer"
target="_blank"
>
CSS Example
</a>
<a
href="/news/sql-example/"
rel="noopener noreferrer"
target="_blank"
>
SQL Example
</a>
<a
href="/news/java-example/"
rel="noopener noreferrer"
target="_blank"
>
Java Example
</a>
<a
href="/news/the-best-angular-examples/"
rel="noopener noreferrer"
target="_blank"
>
Angular Example
</a>
<a
href="/news/the-best-jquery-examples/"
rel="noopener noreferrer"
target="_blank"
>
jQuery Example
</a>
<a
href="/news/the-best-bootstrap-examples/"
rel="noopener noreferrer"
target="_blank"
>
Bootstrap Example
</a>
<a
href="/news/the-best-php-examples/"
rel="noopener noreferrer"
target="_blank"
>
PHP Example
</a>
</div>
<div
className="footer-col-4"
>
<div
className="col-header"
>
Trending Reference
</div>
<a
href="/news/2019-web-developer-roadmap/"
rel="noopener noreferrer"
target="_blank"
>
2019 Web Developer Roadmap
</a>
<a
href="/news/linux-command-line-bash-tutorial/"
rel="noopener noreferrer"
target="_blank"
>
Linux Command Line Guide
</a>
<a
href="/news/the-ultimate-guide-to-git-reset-and-git-revert/"
rel="noopener noreferrer"
target="_blank"
>
Git Reset and Git Revert
</a>
<a
href="/news/the-ultimate-guide-to-git-merge-and-git-rebase/"
rel="noopener noreferrer"
target="_blank"
>
Git Merge and Git Rebase
</a>
<a
href="/news/the-ultimate-guide-to-javascript-array-methods-map/"
rel="noopener noreferrer"
target="_blank"
>
JavaScript Array Map
</a>
<a
href="/news/the-ultimate-guide-to-javascript-array-methods-reduce/"
rel="noopener noreferrer"
target="_blank"
>
JavaScript Array Reduce
</a>
<a
href="/news/the-ultimate-guide-to-javascript-date-and-moment-js/"
rel="noopener noreferrer"
target="_blank"
>
JavaScript Date
</a>
<a
href="/news/the-ultimate-guide-to-javascript-string-methods-split/"
rel="noopener noreferrer"
target="_blank"
>
JavaScript String Split
</a>
<a
href="/news/understanding-flexbox-everything-you-need-to-know-b4013d4dc9af/"
rel="noopener noreferrer"
target="_blank"
>
CSS Flexbox Guide
</a>
<a
href="/news/11-things-i-learned-reading-the-css-grid-specification-fb3983aa5e0/"
rel="noopener noreferrer"
target="_blank"
>
CSS Grid Guide
</a>
<a
href="/news/the-ultimate-guide-to-linux-creating-a-sudo-user/"
rel="noopener noreferrer"
target="_blank"
>
Create a Linux Sudo User
</a>
<a
href="/news/the-ultimate-guide-to-ssh-setting-up-ssh-keys/"
rel="noopener noreferrer"
target="_blank"
>
How to Set Up SSH Keys
</a>
</div>
</div>
</div>
</footer>
`;

View File

@@ -5,6 +5,7 @@
line-height: 1.6;
font-family: 'Lato', sans-serif;
font-size: 15px;
margin-top: auto;
}
.footer-container {

View File

@@ -0,0 +1,129 @@
{
"footerLinks": [
[
{ "to": "/news/about/", "text": "About" },
{ "to": "/donate", "text": "Donate", "internal": true },
{ "to": "/news/shop/", "text": "Shop" },
{
"to": "https://www.linkedin.com/school/free-code-camp/people/",
"text": "Alumni Network"
},
{ "to": "https://github.com/freeCodeCamp/", "text": "Open Source" },
{ "to": "/news/support/", "text": "Support" },
{ "to": "/news/sponsors/", "text": "Sponsors" },
{ "to": "/news/academic-honesty-policy/", "text": "Academic Honesty" },
{ "to": "/news/code-of-conduct/", "text": "Code of Conduct" },
{ "to": "/news/privacy-policy/", "text": "Privacy Policy" },
{ "to": "/news/terms-of-service/", "text": "Terms of Service" },
{ "to": "/news/copyright-policy/", "text": "Copyright Policy" }
],
[
{ "to": "/news/best-python-tutorial/", "text": "Python Tutorial" },
{ "to": "/news/best-git-tutorial/", "text": "Git Tutorial" },
{ "to": "/news/the-best-linux-tutorials/", "text": "Linux Tutorial" },
{
"to": "/news/best-javascript-tutorial/",
"text": "JavaScript Tutorial"
},
{
"to": "/news/best-react-javascript-tutorial/",
"text": "React Tutorial"
},
{ "to": "/news/best-html-html5-tutorial/", "text": "HTML Tutorial" },
{ "to": "/news/best-css-and-css3-tutorial/", "text": "CSS Tutorial" },
{ "to": "/news/best-sql-database-tutorial/", "text": "SQL Tutorial" },
{ "to": "/news/best-java-8-tutorial/", "text": "Java Tutorial" },
{
"to": "/news/best-angular-tutorial-angularjs/",
"text": "Angular Tutorial"
},
{ "to": "/news/best-wordpress-tutorial/", "text": "WordPress Tutorial" },
{
"to": "/news/best-bootstrap-tutorial-responsive-web-design/",
"text": "Bootstrap Tutorial"
}
],
[
{ "to": "/news/python-example/", "text": "Python Example" },
{ "to": "/news/javascript-example/", "text": "JavaScript Example" },
{ "to": "/news/react-examples-reactjs/", "text": "React Example" },
{
"to": "/news/linux-example-bash-command-line/",
"text": "Linux Example"
},
{ "to": "/news/html-and-html5-example/", "text": "HTML Example" },
{ "to": "/news/css-example-css3/", "text": "CSS Example" },
{ "to": "/news/sql-example/", "text": "SQL Example" },
{ "to": "/news/java-example/", "text": "Java Example" },
{ "to": "/news/the-best-angular-examples/", "text": "Angular Example" },
{ "to": "/news/the-best-jquery-examples/", "text": "jQuery Example" },
{
"to": "/news/the-best-bootstrap-examples/",
"text": "Bootstrap Example"
},
{ "to": "/news/the-best-php-examples/", "text": "PHP Example" }
],
[
{
"to": "/news/2019-web-developer-roadmap/",
"text": "2019 Web Developer Roadmap"
},
{
"to": "/news/linux-command-line-bash-tutorial/",
"text": "Linux Command Line Guide"
},
{
"to": "/news/the-ultimate-guide-to-git-reset-and-git-revert/",
"text": "Git Reset and Git Revert"
},
{
"to": "/news/the-ultimate-guide-to-git-merge-and-git-rebase/",
"text": "Git Merge and Git Rebase"
},
{
"to": "/news/the-ultimate-guide-to-javascript-array-methods-map/",
"text": "JavaScript Array Map"
},
{
"to": "/news/the-ultimate-guide-to-javascript-array-methods-reduce/",
"text": "JavaScript Array Reduce"
},
{
"to": "/news/the-ultimate-guide-to-javascript-date-and-moment-js/",
"text": "JavaScript Date"
},
{
"to": "/news/the-ultimate-guide-to-javascript-string-methods-split/",
"text": "JavaScript String Split"
},
{
"to": "/news/understanding-flexbox-everything-you-need-to-know-b4013d4dc9af/",
"text": "CSS Flexbox Guide"
},
{
"to": "/news/11-things-i-learned-reading-the-css-grid-specification-fb3983aa5e0/",
"text": "CSS Grid Guide"
},
{
"to": "/news/the-ultimate-guide-to-linux-creating-a-sudo-user/",
"text": "Create a Linux Sudo User"
},
{
"to": "/news/the-ultimate-guide-to-ssh-setting-up-ssh-keys/",
"text": "How to Set Up SSH Keys"
}
]
]
}

View File

@@ -2,6 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import Link from '../helpers/Link';
import FootCol from './FooterCol';
import './footer.css';
@@ -36,169 +37,16 @@ function Footer() {
<p>
Donations to freeCodeCamp go toward our education initiatives, and
help pay for servers, services, and staff. You can&nbsp;
<Link
className='inline'
external={true}
to='https://freecodecamp.org/donate'
>
<Link className='inline' to='/donate'>
make a tax-deductible donation here
</Link>
.
</p>
</div>
<div className='footer-col-1'>
<div className='col-header'>Our Nonprofit</div>
<Link to='https://www.freecodecamp.org/news/about-freecodecamp/'>
About
</Link>
<Link to='https://freecodecamp.org/donate'>Donate</Link>
<Link external={true} to='https://www.freecodecamp.org/news/shop/'>
Shop
</Link>
<Link
external={true}
to='https://www.linkedin.com/school/free-code-camp/people/'
>
Alumni Network
</Link>
<Link to='https://github.com/freeCodeCamp/'>Open Source</Link>
<Link to='https://www.freecodecamp.org/news/support/'>Support</Link>
<Link to='https://www.freecodecamp.org/news/our-sponsors/'>
Sponsors
</Link>
<Link to='https://www.freecodecamp.org/news/academic-honesty-policy/'>
Academic Honesty
</Link>
<Link to='https://www.freecodecamp.org/news/code-of-conduct/'>
Code of Conduct
</Link>
<Link to='https://www.freecodecamp.org/news/privacy-policy/'>
Privacy Policy
</Link>
<Link to='https://www.freecodecamp.org/news/freecodecamps-terms-of-service/'>
Terms of Service
</Link>
<Link to='https://www.freecodecamp.org/news/copyright-policy/'>
Copyright Policy
</Link>
</div>
<div className='footer-col-2'>
<div className='col-header'>Best Tutorials</div>
<Link to='https://www.freecodecamp.org/news/best-python-tutorial/'>
Python Tutorial
</Link>
<Link to='https://www.freecodecamp.org/news/best-git-tutorial/'>
Git Tutorial
</Link>
<Link to='https://www.freecodecamp.org/news/the-best-linux-tutorials/'>
Linux Tutorial
</Link>
<Link to='https://www.freecodecamp.org/news/best-javascript-tutorial/'>
JavaScript Tutorial
</Link>
<Link to='https://www.freecodecamp.org/news/best-react-javascript-tutorial/'>
React Tutorial
</Link>
<Link to='https://www.freecodecamp.org/news/best-html-html5-tutorial/'>
HTML Tutorial
</Link>
<Link to='https://www.freecodecamp.org/news/best-css-and-css3-tutorial/'>
CSS Tutorial
</Link>
<Link to='https://www.freecodecamp.org/news/best-sql-database-tutorial/'>
SQL Tutorial
</Link>
<Link to='https://www.freecodecamp.org/news/best-java-8-tutorial/'>
Java Tutorial
</Link>
<Link to='https://www.freecodecamp.org/news/best-angular-tutorial-angularjs/'>
Angular Tutorial
</Link>
<Link to='https://www.freecodecamp.org/news/best-wordpress-tutorial/'>
WordPress Tutorial
</Link>
<Link to='https://www.freecodecamp.org/news/best-bootstrap-tutorial-responsive-web-design/'>
Bootstrap Tutorial
</Link>
</div>
<div className='footer-col-3'>
<div className='col-header'>Best Examples</div>
<Link to='https://www.freecodecamp.org/news/python-example/'>
Python Example{' '}
</Link>
<Link to='https://www.freecodecamp.org/news/javascript-example/'>
JavaScript Example
</Link>
<Link to='https://www.freecodecamp.org/news/react-examples-reactjs/'>
React Example
</Link>
<Link to='https://www.freecodecamp.org/news/linux-example-bash-command-line/'>
Linux Example
</Link>
<Link to='https://www.freecodecamp.org/news/html-and-html5-example/'>
HTML Example
</Link>
<Link to='https://www.freecodecamp.org/news/css-example-css3/'>
CSS Example
</Link>
<Link to='https://www.freecodecamp.org/news/sql-example/'>
SQL Example
</Link>
<Link to='https://www.freecodecamp.org/news/java-example/'>
Java Example
</Link>
<Link to='https://www.freecodecamp.org/news/the-best-angular-examples/'>
Angular Example
</Link>
<Link to='https://www.freecodecamp.org/news/the-best-jquery-examples/'>
jQuery Example
</Link>
<Link to='https://www.freecodecamp.org/news/the-best-bootstrap-examples/'>
Bootstrap Example
</Link>
<Link to='https://www.freecodecamp.org/news/the-best-php-examples/'>
PHP Example
</Link>
</div>
<div className='footer-col-4'>
<div className='col-header'>Trending Reference</div>
<Link to='https://www.freecodecamp.org/news/2019-web-developer-roadmap/'>
2019 Web Developer Roadmap
</Link>
<Link to='https://www.freecodecamp.org/news/linux-command-line-bash-tutorial/'>
Linux Command Line Guide
</Link>
<Link to='https://www.freecodecamp.org/news/the-ultimate-guide-to-git-reset-and-git-revert/'>
Git Reset and Git Revert
</Link>
<Link to='https://www.freecodecamp.org/news/the-ultimate-guide-to-git-merge-and-git-rebase/'>
Git Merge and Git Rebase
</Link>
<Link to='https://www.freecodecamp.org/news/the-ultimate-guide-to-javascript-array-methods-map/'>
JavaScript Array Map
</Link>
<Link to='https://www.freecodecamp.org/news/the-ultimate-guide-to-javascript-array-methods-reduce/'>
JavaScript Array Reduce
</Link>
<Link to='https://www.freecodecamp.org/news/the-ultimate-guide-to-javascript-date-and-moment-js/'>
JavaScript Date
</Link>
<Link to='https://www.freecodecamp.org/news/the-ultimate-guide-to-javascript-string-methods-split/'>
JavaScript String Split
</Link>
<Link to='https://www.freecodecamp.org/news/understanding-flexbox-everything-you-need-to-know-b4013d4dc9af/'>
CSS Flexbox Guide
</Link>
<Link to='https://www.freecodecamp.org/news/11-things-i-learned-reading-the-css-grid-specification-fb3983aa5e0/'>
CSS Grid Guide
</Link>
<Link to='https://www.freecodecamp.org/news/the-ultimate-guide-to-linux-creating-a-sudo-user/'>
Create a Linux Sudo User
</Link>
<Link to='https://www.freecodecamp.org/news/the-ultimate-guide-to-ssh-setting-up-ssh-keys/'>
How to Set Up SSH Keys
</Link>
</div>
<FootCol colNum={1} title={'Our Nonprofit'} />
<FootCol colNum={2} title={'Best Tutorials'} />
<FootCol colNum={3} title={'Best Examples'} />
<FootCol colNum={4} title={'Trending Reference'} />
</div>
</div>
</footer>

View File

@@ -75,12 +75,12 @@ exports[`<Block expanded snapshot: block-expanded 1`] = `
<span
className="badge map-badge"
/>
<Unknown
<mockConstructor
onClick={[Function]}
to="/super-block-one/block-a"
>
Introduction to Block A
</Unknown>
</mockConstructor>
</li>
<li
className="map-challenge-title map-challenge-title-completed"
@@ -98,12 +98,12 @@ exports[`<Block expanded snapshot: block-expanded 1`] = `
}
/>
</span>
<Unknown
<mockConstructor
onClick={[Function]}
to="/super-block-one/block-a/challenge-one"
>
Challenge One
</Unknown>
</mockConstructor>
</li>
<li
className="map-challenge-title"
@@ -121,12 +121,12 @@ exports[`<Block expanded snapshot: block-expanded 1`] = `
}
/>
</span>
<Unknown
<mockConstructor
onClick={[Function]}
to="/super-block-one/block-a/challenge-two"
>
Challenge Two
</Unknown>
</mockConstructor>
</li>
<li
className="map-challenge-title"
@@ -144,12 +144,12 @@ exports[`<Block expanded snapshot: block-expanded 1`] = `
}
/>
</span>
<Unknown
<mockConstructor
onClick={[Function]}
to="/super-block-one/block-a/challenge-one"
>
Challenge One
</Unknown>
</mockConstructor>
</li>
<li
className="map-challenge-title map-challenge-title-completed"
@@ -167,12 +167,12 @@ exports[`<Block expanded snapshot: block-expanded 1`] = `
}
/>
</span>
<Unknown
<mockConstructor
onClick={[Function]}
to="/super-block-one/block-a/challenge-two"
>
Challenge Two
</Unknown>
</mockConstructor>
</li>
</ul>
</li>

View File

@@ -0,0 +1,25 @@
/* global expect */
import React from 'react';
import renderer from 'react-test-renderer';
import 'jest-dom/extend-expect';
import Link from './Link';
describe('<Link />', () => {
const externalLink = renderer
.create(<Link external={true} to='/home' />)
.toJSON();
const gatsbyLink = renderer.create(<Link to='/home' />).toJSON();
it('renders to the DOM', () => {
expect(gatsbyLink).toBeTruthy();
});
it('sets target for external links', () => {
expect(externalLink.props.target).toEqual('_blank');
});
it('does not specify target in gatsbyLink', () => {
expect(gatsbyLink.props.target).toBeFalsy();
});
});

View File

@@ -19,9 +19,12 @@ body {
}
.default-layout {
display: block;
margin-top: var(--header-height);
background: var(--secondary-background);
display: flex;
flex-direction: column;
margin-top: var(--header-height);
min-height: calc(100vh - var(--header-height));
}
h1 {
@@ -327,3 +330,7 @@ pre {
.has-success.checkbox-inline label {
color: var(--highlight-color);
}
.panel-primary {
border-color: var(--primary-color);
}