Skip to content

Commit

Permalink
narratives: Add beginning/exit links in mobile
Browse files Browse the repository at this point in the history
Similar to the desktop narratives display, add links to the end of
narratives page to jump to the beginning or exit narrative view.
  • Loading branch information
kairstenfay committed Jan 29, 2020
1 parent c67af39 commit 2084ba9
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/components/narrative/MobileNarrativeDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import React from "react";
import { connect } from "react-redux";
import queryString from "query-string";
import { changePage, EXPERIMENTAL_showMainDisplayMarkdown } from "../../actions/navigation";
import { MobileBannerTop, MobileBannerBottom, MobileContentContainer } from "./styles";
import { TOGGLE_NARRATIVE } from "../../actions/types";
import {
linkStyles,
MobileBannerTop,
MobileBannerBottom,
MobileContentContainer
} from "./styles";
import Tree from "../tree";
import Map from "../map/map";
import MainDisplayMarkdown from "./MainDisplayMarkdown";
Expand Down Expand Up @@ -31,6 +37,9 @@ class MobileNarrativeDisplay extends React.Component {
this.state = {
showingEndOfNarrativePage: false
};
this.exitNarrativeMode = () => {
this.props.dispatch({type: TOGGLE_NARRATIVE, display: false});
};
this.goToNextPage = () => {
if (this.state.showingEndOfNarrativePage) return; // no-op
if (this.props.currentInFocusBlockIdx+1 === this.props.blocks.length) {
Expand Down Expand Up @@ -113,7 +122,18 @@ class MobileNarrativeDisplay extends React.Component {
Previous
</MobileBannerTop>
<MobileContentContainer height={contentHeight+bannerHeight}>
<h1>End</h1>
<h1>End of Narrative</h1>
<a style={{...linkStyles, textAlign: "center"}}
onClick={() => this._goToPage(0)}
>
Jump to the beginning
</a>
<br />
<a style={{...linkStyles, textAlign: "center"}}
onClick={this.exitNarrativeMode}
>
Explore the data
</a>
</MobileContentContainer>
</>
);
Expand Down

0 comments on commit 2084ba9

Please sign in to comment.