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

78 lines
2.1 KiB
JavaScript
Raw Normal View History

2018-04-06 14:51:52 +01:00
/* global graphql */
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-03-26 13:01:24 +01:00
import Link from 'gatsby-link';
2018-04-06 14:51:52 +01:00
import Helmet from 'react-helmet';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { Button } from 'react-bootstrap';
2018-03-26 13:01:24 +01:00
2018-04-06 14:51:52 +01:00
import { ChallengeNode } from '../redux/propTypes';
import { toggleMapModal } from '../redux/app';
import Spacer from '../components/util/Spacer';
2018-04-06 14:51:52 +01:00
import './index.css';
const mapStateToProps = () => ({});
const mapDispatchToProps = dispatch =>
bindActionCreators({ toggleMapModal }, dispatch);
2018-04-06 14:51:52 +01:00
const propTypes = {
data: PropTypes.shape({
challengeNode: ChallengeNode
}),
toggleMapModal: PropTypes.func.isRequired
2018-04-06 14:51:52 +01:00
};
const IndexPage = ({
data: { challengeNode: { title, fields: { slug, blockName } } },
toggleMapModal
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>
2018-04-06 14:51:52 +01:00
<p>
You can earn verified certifications by completing each sections 6
required projects.
2018-04-06 14:51:52 +01:00
</p>
<p>
{'And yes - all of this is 100% free, thanks to the thousands of ' +
'campers who '}
<a href='https://donate.freecodecamp.org' target='_blank'>
donate
</a>{' '}
to our nonprofit.
</p>
<h3>Not sure where to start?</h3>
<p>
We recommend you start at the beginning{' '}
<Link to={slug}>{`${blockName} -> ${title}`}</Link>
</p>
<h3>Want to dive into our curriculum?</h3>
<Button block={true} bsSize='lg' bsStyle='primary' onClick={toggleMapModal}>
Explore the curriculum
</Button>
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, mapDispatchToProps)(IndexPage);
2018-04-06 14:51:52 +01:00
export const query = graphql`
query FirstChallenge {
challengeNode(order: { eq: 0 }, suborder: { eq: 1 }) {
title
fields {
slug
blockName
}
}
}
`;