From 82258073680222356bf680e7880114df4b2b5d78 Mon Sep 17 00:00:00 2001 From: ghalestrilo Date: Thu, 30 Jul 2020 14:36:34 -0300 Subject: [PATCH] :ok_hand: subst left/right props with align prop on --- client/components/Dropdown.jsx | 13 +++++++------ client/modules/IDE/pages/MobileIDEView.jsx | 8 ++------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/client/components/Dropdown.jsx b/client/components/Dropdown.jsx index 5ca33ab1..bd2169b8 100644 --- a/client/components/Dropdown.jsx +++ b/client/components/Dropdown.jsx @@ -16,6 +16,9 @@ const DropdownWrapper = styled.ul` right: ${props => (props.right ? 0 : 'initial')}; left: ${props => (props.left ? 0 : 'initial')}; + ${props => (props.align === 'right' && 'right: 0;')} + ${props => (props.align === 'left' && 'left: 0;')} + text-align: left; width: ${remSize(180)}; @@ -57,8 +60,8 @@ const DropdownWrapper = styled.ul` // TODO: Add Icon to the left of the items in the menu // const MaybeIcon = (Element, label) => Element && ; -const Dropdown = ({ items, right, left }) => ( - +const Dropdown = ({ items, align }) => ( + {/* className="nav__items-left" */} {items && items.map(({ title, icon, href }) => (
  • @@ -73,8 +76,7 @@ const Dropdown = ({ items, right, left }) => ( ); Dropdown.propTypes = { - right: PropTypes.bool, - left: PropTypes.bool, + align: PropTypes.oneOf(['left', 'right']), items: PropTypes.arrayOf(PropTypes.shape({ action: PropTypes.func, icon: PropTypes.func, @@ -84,8 +86,7 @@ Dropdown.propTypes = { Dropdown.defaultProps = { items: [], - right: false, - left: false, + align: null }; export default Dropdown; diff --git a/client/modules/IDE/pages/MobileIDEView.jsx b/client/modules/IDE/pages/MobileIDEView.jsx index d7f7da77..badeda6b 100644 --- a/client/modules/IDE/pages/MobileIDEView.jsx +++ b/client/modules/IDE/pages/MobileIDEView.jsx @@ -57,7 +57,7 @@ const MobileIDEView = (props) => { const { preferences, ide, editorAccessibility, project, updateLintMessage, clearLintMessage, selectedFile, updateFileContent, files, - closeEditorOptions, showEditorOptions, showKeyboardShortcutModal, setUnsavedChanges, + closeEditorOptions, showEditorOptions, startRefreshSketch, stopSketch, expandSidebar, collapseSidebar, clearConsole, console, showRuntimeErrorWarning, hideRuntimeErrorWarning, startSketch } = props; @@ -65,7 +65,7 @@ const MobileIDEView = (props) => { const [tmController, setTmController] = useState(null); // eslint-disable-line - const [triggerNavDropdown, NavDropDown] = useAsModal(); + const [triggerNavDropdown, NavDropDown] = useAsModal(); return ( @@ -213,10 +213,6 @@ MobileIDEView.propTypes = { showEditorOptions: PropTypes.func.isRequired, - showKeyboardShortcutModal: PropTypes.func.isRequired, - - setUnsavedChanges: PropTypes.func.isRequired, - startRefreshSketch: PropTypes.func.isRequired, stopSketch: PropTypes.func.isRequired,