diff --git a/client/components/mobile/Explorer.jsx b/client/components/mobile/Explorer.jsx index 6d4965b3..4e1e902f 100644 --- a/client/components/mobile/Explorer.jsx +++ b/client/components/mobile/Explorer.jsx @@ -5,18 +5,20 @@ import Sidebar from './Sidebar'; import ConnectedFileNode from '../../modules/IDE/components/FileNode'; -const Explorer = ({ id, canEdit }) => ( - - +const Explorer = ({ id, canEdit, onPressClose }) => ( + + ); Explorer.propTypes = { id: PropTypes.number.isRequired, + onPressClose: PropTypes.func, canEdit: PropTypes.bool }; Explorer.defaultProps = { - canEdit: false + canEdit: false, + onPressClose: () => {} }; export default Explorer; diff --git a/client/components/mobile/Sidebar.jsx b/client/components/mobile/Sidebar.jsx index 4e2cfda9..5e872699 100644 --- a/client/components/mobile/Sidebar.jsx +++ b/client/components/mobile/Sidebar.jsx @@ -20,11 +20,13 @@ const SidebarWrapper = styled.div` box-shadow: 0 6px 6px 0 rgba(0,0,0,0.10); `; +// onClick={() => alert('haha')} + const Sidebar = ({ title, onPressClose, children }) => ( {title &&
- +
} {children}
diff --git a/client/components/useAsModal.jsx b/client/components/useAsModal.jsx index a8f4d7d1..ca69fc8d 100644 --- a/client/components/useAsModal.jsx +++ b/client/components/useAsModal.jsx @@ -20,7 +20,11 @@ export default (Element, hasOverlay = false) => { const wrapper = () => (visible &&
{hasOverlay && } -
{Element}
+
+ { (typeof (Element) === 'function') + ? Element(toggle) + : Element} +
); return [toggle, wrapper]; diff --git a/client/modules/IDE/pages/MobileIDEView.jsx b/client/modules/IDE/pages/MobileIDEView.jsx index 2d6fb526..c398f6b0 100644 --- a/client/modules/IDE/pages/MobileIDEView.jsx +++ b/client/modules/IDE/pages/MobileIDEView.jsx @@ -116,8 +116,12 @@ const MobileIDEView = (props) => { align="right" />); - - const [toggleExplorer, Explorer] = useAsModal(, true); + const [toggleExplorer, Explorer] = useAsModal(toggle => + (), true); // toggle sidebar starting opened // useEffect(toggleExplorer, []);