From 22e91037b9739db8525ba8b5b9b602ec38048119 Mon Sep 17 00:00:00 2001 From: Lachlan Kermode Date: Wed, 9 Jan 2019 12:34:07 +0000 Subject: [PATCH] rethink narrative adjust placement; add close --- .../presentational/NarrativeAdjust.js | 2 +- .../presentational/NarrativeClose.js | 17 ++++++ .../presentational/NarrativeControls.js | 33 ++---------- src/scss/cardstack.scss | 4 +- src/scss/narrativecard.scss | 54 +++++++++++++++++-- 5 files changed, 76 insertions(+), 34 deletions(-) create mode 100644 src/components/presentational/NarrativeClose.js diff --git a/src/components/presentational/NarrativeAdjust.js b/src/components/presentational/NarrativeAdjust.js index 2244632..b7b4be3 100644 --- a/src/components/presentational/NarrativeAdjust.js +++ b/src/components/presentational/NarrativeAdjust.js @@ -9,7 +9,7 @@ export default ({ isDisabled, direction, onClickHandler }) => { - chevron_{direction} + {`chevron_${direction}`} ) diff --git a/src/components/presentational/NarrativeClose.js b/src/components/presentational/NarrativeClose.js new file mode 100644 index 0000000..c514479 --- /dev/null +++ b/src/components/presentational/NarrativeClose.js @@ -0,0 +1,17 @@ +import React from 'react' + +export default ({ onClickHandler, closeMsg }) => { + return ( +
+ +
{closeMsg}
+
+ ) +} diff --git a/src/components/presentational/NarrativeControls.js b/src/components/presentational/NarrativeControls.js index 2313f7e..5a120dd 100644 --- a/src/components/presentational/NarrativeControls.js +++ b/src/components/presentational/NarrativeControls.js @@ -1,36 +1,9 @@ import React from 'react' import NarrativeCard from './NarrativeCard' import NarrativeAdjust from './NarrativeAdjust' +import NarrativeClose from './NarrativeClose' export default ({ narrative, methods }) => { - // function renderClose() { - // return ( - // - // ) - // } - - // function _renderActions(current, steps) { - // const prevExists = current !== 0 - // const nextExists = current < steps.length - 1 - // return ( - //
- //
← - //
- //
→ - //
- //
- // ) - // } - if (!narrative) return null const { current, steps } = narrative @@ -50,6 +23,10 @@ export default ({ narrative, methods }) => { direction='right' onClickHandler={methods.onNext} /> + methods.onSelectNarrative(null)} + closeMsg='-- exit from narrative --' + /> ) } diff --git a/src/scss/cardstack.scss b/src/scss/cardstack.scss index 5edf312..a79a44e 100644 --- a/src/scss/cardstack.scss +++ b/src/scss/cardstack.scss @@ -19,8 +19,8 @@ $timeline-height: 170px; &.narrative-mode { right: 10px; left: auto; - top: $narrative-info-max-height + 12px; - height: calc(100% - #{$narrative-info-max-height} - #{$timeline-height} - 12px); + top: $narrative-info-max-height + 12px + 20px; + height: calc(100% - #{$narrative-info-max-height} - #{$timeline-height} - 12px - 20px); } &.full-height { diff --git a/src/scss/narrativecard.scss b/src/scss/narrativecard.scss index 6d7705a..9bf86a4 100644 --- a/src/scss/narrativecard.scss +++ b/src/scss/narrativecard.scss @@ -6,7 +6,7 @@ NARRATIVE INFO */ .narrative-info { position: fixed; - top: 10px; + top: 30px; left: auto; right: 10px; height: 170px; @@ -106,17 +106,18 @@ NARRATIVE INFO position: fixed; // top: calc(50vh - 100pt); bottom: $timeline-height; + // top: 0; right: auto; background-color: rgba(0,0,0,0.8); z-index: 15; // z-index of card-stack is 10 &.left { - left: 0; + right: calc(#{$narrative-info-width} - 70px); } &.right { // right: calc(#{$narrative-info-width} + 10px); - right: 0; + right: 10px; } .material-icons { @@ -134,3 +135,50 @@ NARRATIVE INFO } } } + +.narrative-close { + display: flex; + justify-content: flex-start; + position: fixed; + padding: 2px 5px 0 5px; + // right: $narrative-info-width - 15px - 10px; + right: 10px; + top: 5px; + width: $narrative-info-width - 10px - 2px; + // width: 15px; + background-color: black; + height: 20px; + transition: background-color 0.2s ease; + border: 1px solid black; + + button { + height: 15px; + width: 15px; + } + + .close-text { + display: none; + color: $midgrey; + flex: 1; + width: 100%; + justify-content: center; + font-size: 10pt; + } + + // disable whitening of crosshair on hover + button { + span, span:before, span:after { + background: $midwhite !important; + } + } + + + &:hover { + cursor: pointer; + background-color: $offwhite; + color: black; + .close-text { + display: flex; + } + } +}