diff --git a/client/components/Dropdown.jsx b/client/components/Dropdown.jsx index 48490f9c..5ca33ab1 100644 --- a/client/components/Dropdown.jsx +++ b/client/components/Dropdown.jsx @@ -13,8 +13,9 @@ const DropdownWrapper = styled.ul` color: ${prop('primaryTextColor')}; position: absolute; - top: ${remSize(64)}; - right: ${remSize(16)}; + right: ${props => (props.right ? 0 : 'initial')}; + left: ${props => (props.left ? 0 : 'initial')}; + text-align: left; width: ${remSize(180)}; @@ -56,8 +57,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 }) => ( - +const Dropdown = ({ items, right, left }) => ( + {/* className="nav__items-left" */} {items && items.map(({ title, icon, href }) => (
  • @@ -72,6 +73,8 @@ const Dropdown = ({ items }) => ( ); Dropdown.propTypes = { + right: PropTypes.bool, + left: PropTypes.bool, items: PropTypes.arrayOf(PropTypes.shape({ action: PropTypes.func, icon: PropTypes.func, @@ -81,6 +84,8 @@ Dropdown.propTypes = { Dropdown.defaultProps = { items: [], + right: false, + left: false, }; export default Dropdown; diff --git a/client/components/OverlayManager.jsx b/client/components/OverlayManager.jsx index 53025a7e..1b3b040c 100644 --- a/client/components/OverlayManager.jsx +++ b/client/components/OverlayManager.jsx @@ -1,45 +1,15 @@ -import React, { useRef, useEffect } from 'react'; +import React from 'react'; import PropTypes from 'prop-types'; import { createPortal } from 'react-dom'; -import Dropdown from './Dropdown'; - -import { PreferencesIcon } from '../common/icons'; - const OverlayManager = ({ overlay, hideOverlay }) => { - const ref = useRef({}); - - const handleClickOutside = ({ target }) => { - if (ref && ref.current && !ref.current.contains(target)) { - hideOverlay(); - } - }; - - useEffect(() => { - document.addEventListener('mousedown', handleClickOutside); - - return () => document.removeEventListener('mousedown', handleClickOutside); - }, [ref]); - - const headerNavOptions = [ - { - icon: PreferencesIcon, - title: 'Preferences', - href: '/mobile/preferences', - }, - { icon: PreferencesIcon, title: 'Examples', href: '/mobile/examples' }, - { - icon: PreferencesIcon, - title: 'Original Editor', - href: '/mobile/preferences', - }, - ]; + // const [visible, trigger, setRef] = useModalBehavior(); const jsx = ( -
    { ref.current = r; }} > - {overlay === 'dropdown' && } -
    + {/*
    + {visible && } +
    */}
    ); diff --git a/client/components/mobile/Header.jsx b/client/components/mobile/Header.jsx index 9a40f170..bd223e91 100644 --- a/client/components/mobile/Header.jsx +++ b/client/components/mobile/Header.jsx @@ -37,7 +37,9 @@ const HeaderDiv = styled.div` const IconContainer = styled.div` margin-left: ${props => (props.leftButton ? remSize(32) : remSize(4))}; + list-style: none; display: flex; + flex-direction: horizontal; `; diff --git a/client/modules/IDE/components/Searchbar/Searchbar.jsx b/client/modules/IDE/components/Searchbar/Searchbar.jsx index b81b3bea..765a240d 100644 --- a/client/modules/IDE/components/Searchbar/Searchbar.jsx +++ b/client/modules/IDE/components/Searchbar/Searchbar.jsx @@ -23,20 +23,13 @@ class Searchbar extends React.Component { }); } - handleSearchEnter = (e) => { - if (e.key === 'Enter') { - this.searchChange(); - } - } - searchChange = () => { - if (this.state.searchValue.trim().length === 0) return; this.props.setSearchTerm(this.state.searchValue.trim()); }; handleSearchChange = (e) => { this.setState({ searchValue: e.target.value }, () => { - this.throttledSearchChange(this.state.searchValue); + this.throttledSearchChange(this.state.searchValue.trim()); }); } @@ -53,7 +46,6 @@ class Searchbar extends React.Component { value={searchValue} placeholder={this.props.searchLabel} onChange={this.handleSearchChange} - onKeyUp={this.handleSearchEnter} />