File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,35 @@ import 'uno.css';
3
3
4
4
import { Button } from '~/shared/ui' ;
5
5
6
+ const subscribeSystemFullscreen = ( onStoreChange : ( ) => void ) => {
7
+ document . addEventListener ( 'fullscreenchange' , onStoreChange ) ;
8
+
9
+ return ( ) => document . removeEventListener ( 'fullscreenchange' , onStoreChange ) ;
10
+ } ;
11
+
12
+ const getSystemFullscreenSnapshot = ( ) => {
13
+ return document . fullscreenElement !== null ;
14
+ } ;
15
+
16
+ const getServerSnapshot = ( ) => {
17
+ return undefined ;
18
+ } ;
19
+
20
+ const useSystemFullscreen = ( ) => {
21
+ return useSyncExternalStore (
22
+ subscribeSystemFullscreen ,
23
+ getSystemFullscreenSnapshot ,
24
+ getServerSnapshot ,
25
+ ) ;
26
+ } ;
27
+
6
28
export const App = ( ) => {
29
+ const isFullScreen = useSystemFullscreen ( ) ;
30
+
31
+ if ( isFullScreen ) {
32
+ return null ;
33
+ }
34
+
7
35
return (
8
36
< div className = "fixed h-dvh w-0 top-0 right-0 theme-blue" >
9
37
< div className = "absolute w-14 select-none top-0 right-0 transform-translate-x-0 transform-translate-y-80" >
You can’t perform that action at this time.
0 commit comments