File tree Expand file tree Collapse file tree 4 files changed +20
-8
lines changed Expand file tree Collapse file tree 4 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -5,18 +5,20 @@ import Sidebar from './Sidebar';
55import ConnectedFileNode from '../../modules/IDE/components/FileNode' ;
66
77
8- const Explorer = ( { id, canEdit } ) => (
9- < Sidebar title = "Files" >
10- < ConnectedFileNode id = { id } canEdit = { canEdit } />
8+ const Explorer = ( { id, canEdit, onPressClose } ) => (
9+ < Sidebar title = "Files" onPressClose = { onPressClose } >
10+ < ConnectedFileNode id = { id } canEdit = { canEdit } onClickFile = { onPressClose } />
1111 </ Sidebar >
1212) ;
1313
1414Explorer . propTypes = {
1515 id : PropTypes . number . isRequired ,
16+ onPressClose : PropTypes . func ,
1617 canEdit : PropTypes . bool
1718} ;
1819Explorer . defaultProps = {
19- canEdit : false
20+ canEdit : false ,
21+ onPressClose : ( ) => { }
2022} ;
2123
2224export default Explorer ;
Original file line number Diff line number Diff line change @@ -20,11 +20,13 @@ const SidebarWrapper = styled.div`
2020 box-shadow: 0 6px 6px 0 rgba(0,0,0,0.10);
2121` ;
2222
23+ // onClick={() => alert('haha')}
24+
2325const Sidebar = ( { title, onPressClose, children } ) => (
2426 < SidebarWrapper >
2527 { title &&
2628 < Header slim title = { title } fixed = { false } >
27- < IconButton onPress = { onPressClose } icon = { ExitIcon } aria-label = "Return to ide view" />
29+ < IconButton onClick = { onPressClose } icon = { ExitIcon } aria-label = "Return to ide view" />
2830 </ Header > }
2931 { children }
3032 </ SidebarWrapper >
Original file line number Diff line number Diff line change @@ -20,7 +20,11 @@ export default (Element, hasOverlay = false) => {
2020 const wrapper = ( ) => ( visible &&
2121 < div >
2222 { hasOverlay && < BackgroundOverlay /> }
23- < div ref = { setRef } > { Element } </ div >
23+ < div ref = { setRef } >
24+ { ( typeof ( Element ) === 'function' )
25+ ? Element ( toggle )
26+ : Element }
27+ </ div >
2428 </ div > ) ;
2529
2630 return [ toggle , wrapper ] ;
Original file line number Diff line number Diff line change @@ -116,8 +116,12 @@ const MobileIDEView = (props) => {
116116 align = "right"
117117 /> ) ;
118118
119-
120- const [ toggleExplorer , Explorer ] = useAsModal ( < MobileExplorer id = { getRootFileID ( files ) } canEdit = { false } /> , true ) ;
119+ const [ toggleExplorer , Explorer ] = useAsModal ( toggle =>
120+ ( < MobileExplorer
121+ id = { getRootFileID ( files ) }
122+ canEdit = { false }
123+ onPressClose = { toggle }
124+ /> ) , true ) ;
121125
122126 // toggle sidebar starting opened
123127 // useEffect(toggleExplorer, []);
You can’t perform that action at this time.
0 commit comments