From e6d2a9df93b62413bd54b76609ece6517b65c4db Mon Sep 17 00:00:00 2001 From: Valeriy S Date: Thu, 14 Feb 2019 17:13:35 +0300 Subject: [PATCH] feat(client): place tool panel at the bottom --- .../Challenges/classic/DesktopLayout.js | 83 ++++++++++--------- .../Challenges/classic/MobileLayout.js | 9 +- .../src/templates/Challenges/classic/Show.js | 18 +++- .../templates/Challenges/classic/classic.css | 12 ++- .../Challenges/components/Tool-Panel.js | 13 ++- 5 files changed, 83 insertions(+), 52 deletions(-) diff --git a/client/src/templates/Challenges/classic/DesktopLayout.js b/client/src/templates/Challenges/classic/DesktopLayout.js index 3379bbeadc..004659dab1 100644 --- a/client/src/templates/Challenges/classic/DesktopLayout.js +++ b/client/src/templates/Challenges/classic/DesktopLayout.js @@ -1,4 +1,4 @@ -import React, { Component } from 'react'; +import React, { Component, Fragment } from 'react'; import { ReflexContainer, ReflexSplitter, ReflexElement } from 'react-reflex'; import PropTypes from 'prop-types'; @@ -14,7 +14,8 @@ const propTypes = { onStopResize: PropTypes.func, onResize: PropTypes.func }), - testOutput: PropTypes.element + testOutput: PropTypes.element, + toolPanel: PropTypes.element }; class DesktopLayout extends Component { @@ -26,46 +27,50 @@ class DesktopLayout extends Component { editor, testOutput, hasPreview, - preview + preview, + toolPanel } = this.props; return ( - - - {instructions} - - - - {challengeFile && ( - - - {editor} - - - - {testOutput} - - - )} - - {hasPreview && } - {hasPreview && ( - - {preview} + + + + {instructions} - )} - + + + {challengeFile && ( + + + {editor} + + + + {testOutput} + + + )} + + {hasPreview && } + {hasPreview && ( + + {preview} + + )} + + {toolPanel} + ); } } diff --git a/client/src/templates/Challenges/classic/MobileLayout.js b/client/src/templates/Challenges/classic/MobileLayout.js index 007aaab91c..916204cb54 100644 --- a/client/src/templates/Challenges/classic/MobileLayout.js +++ b/client/src/templates/Challenges/classic/MobileLayout.js @@ -3,7 +3,6 @@ import PropTypes from 'prop-types'; import { TabPane, Tabs } from '@freecodecamp/react-bootstrap'; import { connect } from 'react-redux'; -import ToolPanel from '../components/Tool-Panel'; import { createStructuredSelector } from 'reselect'; import { currentTabSelector, moveToTab } from '../redux'; import { bindActionCreators } from 'redux'; @@ -23,13 +22,12 @@ const mapDispatchToProps = dispatch => const propTypes = { currentTab: PropTypes.number, editor: PropTypes.element, - guideUrl: PropTypes.string, hasPreview: PropTypes.bool, instructions: PropTypes.element, moveToTab: PropTypes.func, preview: PropTypes.element, testOutput: PropTypes.element, - videoUrl: PropTypes.string + toolPanel: PropTypes.element }; class MobileLayout extends Component { @@ -42,8 +40,7 @@ class MobileLayout extends Component { testOutput, hasPreview, preview, - guideUrl, - videoUrl + toolPanel } = this.props; const editorTabPaneProps = { @@ -74,7 +71,7 @@ class MobileLayout extends Component { )} - + {toolPanel} ); } diff --git a/client/src/templates/Challenges/classic/Show.js b/client/src/templates/Challenges/classic/Show.js index fa4bebc3c6..63eb3f87b9 100644 --- a/client/src/templates/Challenges/classic/Show.js +++ b/client/src/templates/Challenges/classic/Show.js @@ -19,6 +19,7 @@ import VideoModal from '../components/VideoModal'; import ResetModal from '../components/ResetModal'; import MobileLayout from './MobileLayout'; import DesktopLayout from './DesktopLayout'; +import ToolPanel from '../components/Tool-Panel'; import { randomCompliment } from '../utils/get-words'; import { createGuideUrl } from '../utils'; @@ -246,6 +247,17 @@ class ShowClassic extends Component { ); } + renderToolPanel(isMobile) { + return ( + + ); + } + render() { return ( @@ -257,14 +269,13 @@ class ShowClassic extends Component { matches ? ( ) : ( ) } diff --git a/client/src/templates/Challenges/classic/classic.css b/client/src/templates/Challenges/classic/classic.css index 11ea39d1a1..c21229059b 100644 --- a/client/src/templates/Challenges/classic/classic.css +++ b/client/src/templates/Challenges/classic/classic.css @@ -3,7 +3,7 @@ } .desktop-layout { - height: calc(100vh - var(--header-height)); + height: calc(100vh - var(--header-height) - 42px); } .monaco-menu .action-label { @@ -34,3 +34,13 @@ height: 100%; overflow: hidden; } + +.classic-tool-panel.tool-panel-group { + display: flex; + flex-direction: row-reverse; + padding: 0 2px; +} + +.classic-tool-panel.tool-panel-group .btn-block + .btn-block { + margin: 0 2px 0 0; +} diff --git a/client/src/templates/Challenges/components/Tool-Panel.js b/client/src/templates/Challenges/components/Tool-Panel.js index d214389593..5412c4fcf5 100644 --- a/client/src/templates/Challenges/components/Tool-Panel.js +++ b/client/src/templates/Challenges/components/Tool-Panel.js @@ -21,6 +21,7 @@ const mapDispatchToProps = dispatch => ); const propTypes = { + className: PropTypes.string, executeChallenge: PropTypes.func.isRequired, guideUrl: PropTypes.string, isMobile: PropTypes.bool, @@ -31,6 +32,7 @@ const propTypes = { }; function ToolPanel({ + className, executeChallenge, isMobile, openHelpModal, @@ -41,9 +43,11 @@ function ToolPanel({ }) { return ( -
+ } ${className}`} + > @@ -92,7 +96,10 @@ function ToolPanel({ ToolPanel.displayName = 'ToolPanel'; ToolPanel.propTypes = propTypes; -export default connect(mapStateToProps, mapDispatchToProps)(ToolPanel); +export default connect( + mapStateToProps, + mapDispatchToProps +)(ToolPanel); /*