Files
freeCodeCamp/client/src/pages/learn.js

112 lines
2.6 KiB
JavaScript
Raw Normal View History

2018-03-26 13:01:24 +01:00
import React from 'react';
2018-04-06 14:51:52 +01:00
import PropTypes from 'prop-types';
2019-02-21 20:55:36 +05:30
import { graphql } from 'gatsby';
2018-04-06 14:51:52 +01:00
import Helmet from 'react-helmet';
import { connect } from 'react-redux';
2018-03-26 13:01:24 +01:00
import {
ChallengeNode,
AllChallengeNode,
AllMarkdownRemark
} from '../redux/propTypes';
import LearnLayout from '../components/layouts/Learn';
2019-02-21 20:55:36 +05:30
import { Link, Spacer } from '../components/helpers';
import Map from '../components/Map';
2018-04-06 14:51:52 +01:00
import './learn.css';
2018-04-06 14:51:52 +01:00
const mapStateToProps = () => ({});
2018-04-06 14:51:52 +01:00
const propTypes = {
data: PropTypes.shape({
challengeNode: ChallengeNode,
allChallengeNode: AllChallengeNode,
allMarkdownRemark: AllMarkdownRemark
})
2018-04-06 14:51:52 +01:00
};
const IndexPage = ({
data: {
challengeNode: {
fields: { slug }
},
allChallengeNode: { edges },
allMarkdownRemark: { edges: mdEdges }
}
2018-04-06 14:51:52 +01:00
}) => (
<LearnLayout>
<div className='learn-page-wrapper'>
2019-02-16 13:01:15 +05:30
<Helmet title='Learn | freeCodeCamp.org' />
2019-08-30 12:54:01 +03:00
<Spacer size={2} />
2019-08-19 18:54:04 +03:00
<h1 className='text-center'>Welcome to the freeCodeCamp curriculum</h1>
<p>
We have thousands of coding lessons to help you improve your skills.
</p>
<p>You can earn each certification by completing its 5 final projects.</p>
<p>
And yes - all of this is 100% free, thanks to the thousands of campers
who{' '}
2019-02-21 20:55:36 +05:30
<Link external={true} to='/donate'>
donate
2019-02-21 20:55:36 +05:30
</Link>{' '}
to our nonprofit.
</p>
<p>
If you are new to coding, we recommend you{' '}
<Link to={slug}>start at the beginning</Link>.
</p>
<Map
introNodes={mdEdges.map(({ node }) => node)}
nodes={edges
.map(({ node }) => node)
.filter(({ isPrivate }) => !isPrivate)}
/>
</div>
</LearnLayout>
2018-03-26 13:01:24 +01:00
);
2018-04-06 14:51:52 +01:00
IndexPage.displayName = 'IndexPage';
IndexPage.propTypes = propTypes;
export default connect(mapStateToProps)(IndexPage);
2018-04-06 14:51:52 +01:00
export const query = graphql`
query FirstChallenge {
challengeNode(order: { eq: 0 }, challengeOrder: { eq: 0 }) {
2018-04-06 14:51:52 +01:00
fields {
slug
}
}
allChallengeNode(sort: { fields: [superOrder, order, challengeOrder] }) {
edges {
node {
fields {
slug
blockName
}
id
block
title
isRequired
superBlock
dashedName
}
}
}
allMarkdownRemark(filter: { frontmatter: { block: { ne: null } } }) {
edges {
node {
frontmatter {
title
block
}
fields {
slug
}
}
2018-04-06 14:51:52 +01:00
}
}
}
`;