Merge pull request #72 from Bouncey/feat/mapFromIntro
Add map button to intro pages
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
784bb3f424
commit
b28b0d9d4f
@ -1,21 +1,29 @@
|
|||||||
/* global graphql */
|
/* global graphql */
|
||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import { bindActionCreators } from 'redux';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
import Link from 'gatsby-link';
|
import Link from 'gatsby-link';
|
||||||
import Helmet from 'react-helmet';
|
import Helmet from 'react-helmet';
|
||||||
import { Button, ListGroup, ListGroupItem } from 'react-bootstrap';
|
import { Button, ListGroup, ListGroupItem } from 'react-bootstrap';
|
||||||
|
|
||||||
import FullWidthRow from '../../components/util/FullWidthRow';
|
import FullWidthRow from '../../components/util/FullWidthRow';
|
||||||
import ButtonSpacer from '../../components/util/ButtonSpacer';
|
import ButtonSpacer from '../../components/util/ButtonSpacer';
|
||||||
|
import { toggleMapModal } from '../../redux/app';
|
||||||
import { MarkdownRemark, AllChallengeNode } from '../../redux/propTypes';
|
import { MarkdownRemark, AllChallengeNode } from '../../redux/propTypes';
|
||||||
|
|
||||||
import './intro.css';
|
import './intro.css';
|
||||||
|
|
||||||
|
const mapStateToProps = () => ({});
|
||||||
|
const mapDispatchToProps = dispatch =>
|
||||||
|
bindActionCreators({ toggleMapModal }, dispatch);
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
data: PropTypes.shape({
|
data: PropTypes.shape({
|
||||||
markdownRemark: MarkdownRemark,
|
markdownRemark: MarkdownRemark,
|
||||||
allChallengeNode: AllChallengeNode
|
allChallengeNode: AllChallengeNode
|
||||||
})
|
}),
|
||||||
|
toggleMapModal: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
function renderMenuItems({ edges = [] }) {
|
function renderMenuItems({ edges = [] }) {
|
||||||
@ -26,7 +34,10 @@ function renderMenuItems({ edges = [] }) {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
function IntroductionPage({ data: { markdownRemark, allChallengeNode } }) {
|
function IntroductionPage({
|
||||||
|
data: { markdownRemark, allChallengeNode },
|
||||||
|
toggleMapModal
|
||||||
|
}) {
|
||||||
const { html, frontmatter: { block } } = markdownRemark;
|
const { html, frontmatter: { block } } = markdownRemark;
|
||||||
const firstLesson = allChallengeNode && allChallengeNode.edges[0].node;
|
const firstLesson = allChallengeNode && allChallengeNode.edges[0].node;
|
||||||
const firstLessonPath = firstLesson
|
const firstLessonPath = firstLesson
|
||||||
@ -50,6 +61,9 @@ function IntroductionPage({ data: { markdownRemark, allChallengeNode } }) {
|
|||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
<ButtonSpacer />
|
<ButtonSpacer />
|
||||||
|
<Button block={true} bsSize='sm' onClick={toggleMapModal}>
|
||||||
|
View the curriculum
|
||||||
|
</Button>
|
||||||
<hr />
|
<hr />
|
||||||
</FullWidthRow>
|
</FullWidthRow>
|
||||||
<FullWidthRow>
|
<FullWidthRow>
|
||||||
@ -65,7 +79,7 @@ function IntroductionPage({ data: { markdownRemark, allChallengeNode } }) {
|
|||||||
IntroductionPage.displayName = 'IntroductionPage';
|
IntroductionPage.displayName = 'IntroductionPage';
|
||||||
IntroductionPage.propTypes = propTypes;
|
IntroductionPage.propTypes = propTypes;
|
||||||
|
|
||||||
export default IntroductionPage;
|
export default connect(mapStateToProps, mapDispatchToProps)(IntroductionPage);
|
||||||
|
|
||||||
export const query = graphql`
|
export const query = graphql`
|
||||||
query IntroPageBySlug($slug: String!, $block: String!) {
|
query IntroPageBySlug($slug: String!, $block: String!) {
|
||||||
|
Reference in New Issue
Block a user