File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -13,19 +13,33 @@ interface Props {
1313const styles = {
1414 page : {
1515 margin : 0 ,
16- width : window . innerWidth - 20 , // 220
17- height : window . innerHeight - 20 , // 655
1816 backgroundColor : 'white' ,
1917 } ,
2018}
2119
22- console . log ( 'page styles' )
23- console . log ( JSON . stringify ( styles . page ) )
24-
2520const Routes = ( { state } : Props ) => {
21+ const [ dimensions , setDimensions ] = React . useState ( {
22+ width : window . innerWidth - 20 ,
23+ height : window . innerHeight - 20 ,
24+ } )
25+
26+ // solution for windows getting off size
27+ // without adding multiple listeners
28+ React . useEffect ( ( ) => {
29+ const dimensionsInterval = setInterval ( ( ) => {
30+ setDimensions ( {
31+ width : window . innerWidth - 20 ,
32+ height : window . innerHeight - 20 ,
33+ } )
34+ } , 5000 )
35+ return ( ) => {
36+ clearInterval ( dimensionsInterval )
37+ }
38+ } )
39+
2640 // TODO: refactor cond to user <Router><Route> and accept first route as if/else if
2741 return (
28- < div style = { styles . page } >
42+ < div style = { { ... styles . page , ... dimensions } } >
2943 < Cond state = { state } path = "SelectTutorial.Startup" >
3044 < Loading />
3145 </ Cond >
You can’t perform that action at this time.
0 commit comments