diff --git a/src/CodeSlide.js b/src/CodeSlide.js index 480729c..98de9f3 100644 --- a/src/CodeSlide.js +++ b/src/CodeSlide.js @@ -5,6 +5,7 @@ const {Slide} = require('spectacle'); const CodeSlideTitle = require('./CodeSlideTitle'); const CodeSlideNote = require('./CodeSlideNote'); const CodeSlideImage = require('./CodeSlideImage'); +const CodeSlideControlHelpers = require('./CodeSlideControlHelpers'); const clamp = require('lodash.clamp'); const padStart = require('lodash.padstart'); @@ -188,7 +189,7 @@ class CodeSlide extends React.Component { } render() { - const {code, lang, ranges, color, bgColor, notes, showLineNumbers, ...rest} = this.props; + const {code, lang, ranges, color, bgColor, notes, showLineNumbers, withControlHelpers, ...rest} = this.props; const {active} = this.state; const range = ranges[active] || {}; @@ -217,12 +218,14 @@ class CodeSlide extends React.Component { {range.title && {range.title}}
-          {lines}
+          {lines}
         
{range.note && {range.note}} {range.image && } + + {withControlHelpers && } ); } diff --git a/src/CodeSlideControlHelpers.js b/src/CodeSlideControlHelpers.js new file mode 100644 index 0000000..344f33a --- /dev/null +++ b/src/CodeSlideControlHelpers.js @@ -0,0 +1,97 @@ +const React = require('react'); + +const blinkAnimation = 'code-slide-control-helpers-blink'; +const shakeAnimation = 'code-slide-control-helpers-shake'; + +const getContainerTransform = (extraTransform = '') => `translate(-100%, -100%) ${extraTransform}` + +const styles = { + container: { + position: 'fixed', + bottom: '-15%', + transform: getContainerTransform() + }, + controlKey: { + height: '50px', + width: '50px', + backgroundColor: 'white', + color: 'black', + margin: '15px 0', + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + borderRadius: '8px', + border: 'solid 1px rgba(0, 0, 0, 0.4)', + opacity: 0.3 + }, + controlKeyActive: { + animation: `2.5s ease-in-out infinite alternate ${blinkAnimation} ` + }, + containerPristine: { + animation: `2.5s ease-in-out infinite 1s alternate ${shakeAnimation}` + } +}; + +class CodeSlideControlHelpers extends React.Component { + render() { + const { hasNextRange, pristine } = this.props; + return ( +
+
+
+ +
+
+ ↑ +
+
+ ↓ +
+
+
+
+
+ ); + } +} + +module.exports = CodeSlideControlHelpers;