mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-12-04 23:32:54 +01:00
screenshot button in fullscreen
This commit is contained in:
7 files changed
+46
-36
No files matched your search
@@ -29,6 +29,10 @@
|
||||
box-shadow: var(--shadow-subtle);
|
||||
border-radius: var(--space-4);
|
||||
outline: var(--outline-interactive) !important;
|
||||
|
||||
&[data-size="minor"] {
|
||||
max-width: min(25rem, 100%);
|
||||
}
|
||||
}
|
||||
|
||||
.Title {
|
||||
@@ -43,4 +47,3 @@
|
||||
color: var(--gray-11);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ export function ScreenshotButton({ canvas, name, children, ...props }: Props) {
|
||||
|
||||
<Dialog.Portal>
|
||||
<Dialog.Overlay>
|
||||
<Dialog.Content>
|
||||
<Dialog.Content data-size="minor">
|
||||
<Dialog.Header>
|
||||
<Dialog.Title>{strings.common.screenshot.title}</Dialog.Title>
|
||||
<Dialog.Description>
|
||||
|
||||
@@ -38,7 +38,7 @@ export const SettingsDialog = withLocale(
|
||||
|
||||
<Dialog.Portal>
|
||||
<Dialog.Overlay>
|
||||
<Dialog.Content>
|
||||
<Dialog.Content data-size="minor">
|
||||
<Dialog.Header>
|
||||
<Dialog.Title>{strings.navbar.settings}</Dialog.Title>
|
||||
</Dialog.Header>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { EnterFullScreenIcon, ExitFullScreenIcon } from "@radix-ui/react-icons";
|
||||
import { useCallback, useEffect, useState, type RefObject } from "react";
|
||||
import { useCallback, type RefObject } from "react";
|
||||
import { useFullScreen } from "../../hooks/useFullScreen";
|
||||
import { IconButton } from "../IconButton";
|
||||
import styles from "./index.module.css";
|
||||
|
||||
@@ -8,19 +9,7 @@ interface TankopediaFullscreenProps {
|
||||
}
|
||||
|
||||
export function TankopediaFullscreen({ target }: TankopediaFullscreenProps) {
|
||||
const [isFullscreen, setIsFullscreen] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
function handleFullscreenChange() {
|
||||
setIsFullscreen(document.fullscreenElement === target.current);
|
||||
}
|
||||
|
||||
document.addEventListener("fullscreenchange", handleFullscreenChange);
|
||||
|
||||
return () => {
|
||||
document.removeEventListener("fullscreenchange", handleFullscreenChange);
|
||||
};
|
||||
}, []);
|
||||
const isFullscreen = useFullScreen();
|
||||
|
||||
const handleClick = useCallback(() => {
|
||||
if (isFullscreen) {
|
||||
|
||||
Reference in new issue
Block a user