Files
freeCodeCamp/packages/learn/src/pages/index.js

111 lines
2.5 KiB
JavaScript
Raw Normal View History

2018-04-06 14:51:52 +01:00
/* global graphql */
/* eslint-disable max-len */
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';
2018-09-11 15:35:46 +03:00
import { Link } 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 Spacer from '../components/util/Spacer';
import Map from '../components/Map';
2018-04-06 14:51:52 +01:00
import './index.css';
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
}) => (
<div className='index-page-wrapper'>
<Helmet title='Welcome to learn.freeCodeCamp!' />
<Spacer />
<Spacer />
<h2>Welcome to the freeCodeCamp curriculum</h2>
<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>
2018-04-06 14:51:52 +01:00
<p>
And yes - all of this is 100% free, thanks to the thousands of campers who{' '}
2018-04-06 14:51:52 +01:00
<a href='https://donate.freecodecamp.org' target='_blank'>
donate
</a>{' '}
to our nonprofit.
</p>
<p>
If you are new to coding, we recommend you{' '}
<Link to={slug}>start at the beginning</Link>.
2018-04-06 14:51:52 +01:00
</p>
<Spacer />
<Map
introNodes={mdEdges.map(({ node }) => node)}
nodes={edges
.map(({ node }) => node)
.filter(({ isPrivate }) => !isPrivate)}
/>
2018-03-26 13:01:24 +01:00
</div>
);
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 }, suborder: { eq: 1 }) {
fields {
slug
}
}
allChallengeNode(
filter: { isPrivate: { eq: false } }
sort: { fields: [superOrder, order, suborder] }
) {
edges {
node {
fields {
slug
blockName
}
id
block
title
isRequired
isPrivate
superBlock
dashedName
}
}
}
allMarkdownRemark(filter: { frontmatter: { block: { ne: null } } }) {
edges {
node {
frontmatter {
title
block
}
fields {
slug
}
}
2018-04-06 14:51:52 +01:00
}
}
}
`;