1
- import React from 'react' ;
1
+ import React , { useEffect } from 'react' ;
2
2
import './index.css' ;
3
3
import { AppProps } from './types/AppProps' ;
4
4
import { useOnOutsideClick } from './hooks/useOnOutsideClick' ;
@@ -9,14 +9,14 @@ import ErrorMessage from './components/ErrorMessageDisplay';
9
9
import Menu from './components/Menu' ;
10
10
import { useSyncHotkeys } from './hooks/useSyncHotkeys' ;
11
11
import { useHotkeys } from './hooks/useHotkeys' ;
12
- import { useEffect } from 'react' ;
13
12
import NewUserModal from './components/modals/NewUserModal' ;
14
13
import NewEnhetModal from './components/modals/NewEnhetModal' ;
15
14
import { useSyncStore } from './hooks/useSyncStore' ;
16
15
import useGlobalHandlers from './store/GlobalHandlers' ;
16
+ import classNames from 'classnames' ;
17
17
18
18
const App : React . FC < AppProps > = ( props : AppProps ) => {
19
- const { onLinkClick } = props ;
19
+ const { onLinkClick, isFullScreen } = props ;
20
20
21
21
useSyncStore ( props ) ;
22
22
useSyncAppState ( props ) ;
@@ -31,23 +31,31 @@ const App: React.FC<AppProps> = (props: AppProps) => {
31
31
} , [ props . enableHotkeys , startListening , stopListening ] ) ;
32
32
33
33
const ref = useOnOutsideClick < HTMLElement > ( ( ) =>
34
- useAppState . setState ( { open : false } ) ,
34
+ useAppState . setState ( { open : false } )
35
35
) ;
36
36
37
37
const setHandler = useGlobalHandlers ( ( state ) => state . setHandler ) ;
38
38
39
39
useEffect ( ( ) => {
40
40
if ( onLinkClick ) {
41
41
setHandler ( 'onLinkClick' , ( linkText , url ) =>
42
- onLinkClick ( { text : linkText , url } ) ,
42
+ onLinkClick ( { text : linkText , url } )
43
43
) ;
44
44
}
45
45
} , [ setHandler , onLinkClick ] ) ;
46
46
47
+ useEffect ( ( ) => {
48
+ if ( props . isFullScreen ) {
49
+ useAppState . setState ( { open : true } ) ;
50
+ }
51
+ } , [ props . isFullScreen ] ) ;
52
+
47
53
return (
48
54
< >
49
- < div className = "dekorator" data-theme = "internarbeidsflatedecorator-theme" >
50
- < header ref = { ref } className = "dr-font-arial dr-text-white" >
55
+ < div className = { classNames ( 'dekorator' , { 'dr-h-screen' : isFullScreen } ) }
56
+ data-theme = "internarbeidsflatedecorator-theme" >
57
+ < header ref = { ref }
58
+ className = { classNames ( 'dr-font-arial' , 'dr-text-white' , { 'dr-h-full dr-flex dr-flex-col' : isFullScreen } ) } >
51
59
< Banner />
52
60
< Menu />
53
61
< ErrorMessage />
0 commit comments