From 46aeaf52177e818065f89e7014f3e62ccab0b34c Mon Sep 17 00:00:00 2001 From: Lachlan Kermode Date: Tue, 8 Jan 2019 18:01:08 +0000 Subject: [PATCH] add NarrativeAdjust as arrows above timeline --- src/components/Dashboard.jsx | 14 +++----- .../presentational/NarrativeAdjust.js | 16 +++++++++ .../presentational/NarrativeCard.js | 32 +---------------- .../presentational/NarrativeControls.js | 15 ++++++++ src/scss/narrativecard.scss | 35 ++++++++++++++++++- 5 files changed, 70 insertions(+), 42 deletions(-) create mode 100644 src/components/presentational/NarrativeAdjust.js diff --git a/src/components/Dashboard.jsx b/src/components/Dashboard.jsx index c207d9f..18a77f6 100644 --- a/src/components/Dashboard.jsx +++ b/src/components/Dashboard.jsx @@ -126,6 +126,10 @@ class Dashboard extends React.Component { getCategoryColor={category => this.getCategoryColor(category)} /> this.moveInNarrative(1), onPrev: () => this.moveInNarrative(-1), @@ -165,16 +169,6 @@ function mapDispatchToProps(dispatch) { } } -function injectSource(id) { - return state => ({ - ...state, - app: { - ...state.app, - source: state.domain.sources[id] - } - }) -} - export default connect( state => state, mapDispatchToProps, diff --git a/src/components/presentational/NarrativeAdjust.js b/src/components/presentational/NarrativeAdjust.js new file mode 100644 index 0000000..2244632 --- /dev/null +++ b/src/components/presentational/NarrativeAdjust.js @@ -0,0 +1,16 @@ +import React from 'react' + +export default ({ isDisabled, direction, onClickHandler }) => { + return ( +
+ + chevron_{direction} + +
+ ) +} diff --git a/src/components/presentational/NarrativeCard.js b/src/components/presentational/NarrativeCard.js index 1112f16..874578c 100644 --- a/src/components/presentational/NarrativeCard.js +++ b/src/components/presentational/NarrativeCard.js @@ -3,37 +3,7 @@ import { connect } from 'react-redux' import { selectActiveNarrative } from '../../selectors' function NarrativeCard ({ narrative }) { - // function renderClose() { - // return ( - // - // ) - // } - - // function _renderActions(current, steps) { - // const prevExists = current !== 0 - // const nextExists = current < steps.length - 1 - // return ( - //
- //
← - //
- //
→ - //
- //
- // ) - // } - - // no display if no narrative - if (!narrative) return null - + // no display if no narrative const { steps, current } = narrative if (steps[current]) { diff --git a/src/components/presentational/NarrativeControls.js b/src/components/presentational/NarrativeControls.js index 76f96e5..2313f7e 100644 --- a/src/components/presentational/NarrativeControls.js +++ b/src/components/presentational/NarrativeControls.js @@ -1,5 +1,6 @@ import React from 'react' import NarrativeCard from './NarrativeCard' +import NarrativeAdjust from './NarrativeAdjust' export default ({ narrative, methods }) => { // function renderClose() { @@ -30,11 +31,25 @@ export default ({ narrative, methods }) => { // ) // } + if (!narrative) return null + const { current, steps } = narrative + const prevExists = current !== 0 + const nextExists = current < steps.length - 1 return ( + + ) } diff --git a/src/scss/narrativecard.scss b/src/scss/narrativecard.scss index b4c8930..6d7705a 100644 --- a/src/scss/narrativecard.scss +++ b/src/scss/narrativecard.scss @@ -1,4 +1,5 @@ $narrative-info-width: 370px; +$timeline-height: 170px; /* NARRATIVE INFO @@ -8,7 +9,6 @@ NARRATIVE INFO top: 10px; left: auto; right: 10px; - // height: auto; height: 170px; width: $narrative-info-width; box-sizing: border-box; @@ -101,3 +101,36 @@ NARRATIVE INFO } } } + +.narrative-adjust { + position: fixed; + // top: calc(50vh - 100pt); + bottom: $timeline-height; + right: auto; + background-color: rgba(0,0,0,0.8); + z-index: 15; // z-index of card-stack is 10 + + &.left { + left: 0; + } + + &.right { + // right: calc(#{$narrative-info-width} + 10px); + right: 0; + } + + .material-icons { + font-size: 60pt; + color: $offwhite; + transition: color 0.2s ease; + + &.disabled { + color: $darkgrey; + } + + &:hover { + cursor: pointer; + color: $darkgrey; + } + } +}