Skip to content

Commit e55e0ed

Browse files
committed
feat: 브라우저가 전체 화면 모드로 전환된다면 콘텐츠 숨김 처리
1 parent 5e8a461 commit e55e0ed

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/contentScripts/pages/App.tsx

+28
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,35 @@ import 'uno.css';
33

44
import { Button } from '~/shared/ui';
55

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+
628
export const App = () => {
29+
const isFullScreen = useSystemFullscreen();
30+
31+
if (isFullScreen) {
32+
return null;
33+
}
34+
735
return (
836
<div className="fixed h-dvh w-0 top-0 right-0 theme-blue">
937
<div className="absolute w-14 select-none top-0 right-0 transform-translate-x-0 transform-translate-y-80">

0 commit comments

Comments
 (0)