File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
+ import styled from 'styled-components' ;
2
3
import { useModalBehavior } from '../utils/custom-hooks' ;
3
4
5
+ const BackgroundOverlay = styled . div `
6
+ position: absolute;
7
+ z-index: 2;
8
+ width: 100% !important;
9
+ height: 100% !important;
10
+
11
+ background: black;
12
+ opacity: 0.3;
13
+ ` ;
4
14
5
- export default ( component ) => {
6
- const [ visible , trigger , setRef ] = useModalBehavior ( ) ;
15
+ export default ( component , hasOverlay = false ) => {
16
+ const [ visible , toggle , setRef ] = useModalBehavior ( ) ;
7
17
8
- const wrapper = ( ) => < div ref = { setRef } > { visible && component } </ div > ; // eslint-disable-line
18
+ const wrapper = ( ) => ( < div >
19
+ { hasOverlay && visible && < BackgroundOverlay /> }
20
+ < div ref = { setRef } > { visible && component } </ div >
21
+ </ div > ) ; // eslint-disable-line
9
22
10
- return [ trigger , wrapper ] ;
23
+ return [ toggle , wrapper ] ;
11
24
} ;
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ const MobileIDEView = (props) => {
99
99
const [ toggleExplorer , Explorer ] = useAsModal ( < Sidebar
100
100
title = "hahaha"
101
101
onPressClose = { ( ) => { } }
102
- /> ) ;
102
+ /> , true ) ;
103
103
104
104
// toggle sidebar starting opened
105
105
useEffect ( toggleExplorer , [ ] ) ;
You can’t perform that action at this time.
0 commit comments