Files
bscscore/src/components/FullscreenToggle.tsx
T
Frank Schwenk 8085d2ecc8 feat(storage): migrate to IndexedDB with localStorage fallback and async app flow
- Add IndexedDB service with schema, indexes, and player stats
- Migrate GameService to async IndexedDB and auto-migrate from localStorage
- Update hooks and App handlers to async; add error handling and UX feedback
- Convert remaining JSX components to TSX
- Add test utility for IndexedDB and migration checks
- Extend game types with sync fields for future online sync
2025-10-30 09:36:17 +01:00

35 lines
966 B
TypeScript

import { h } from 'preact';
import { useCallback } from 'preact/hooks';
import styles from './FullscreenToggle.module.css';
/**
* Button to toggle fullscreen mode.
* @returns {import('preact').VNode}
*/
const FullscreenToggle = () => {
// Toggle fullscreen mode for the document
const handleToggle = useCallback(() => {
if (!document.fullscreenElement) {
document.documentElement.requestFullscreen();
} else {
document.exitFullscreen();
}
}, []);
return (
<button
id="fullscreen-toggle"
className={styles.fullscreenToggle}
onClick={handleToggle}
title="Vollbild umschalten"
aria-label="Vollbild umschalten"
type="button"
>
<svg viewBox="0 0 24 24" width="24" height="24" aria-hidden="true">
<path fill="currentColor" d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/>
</svg>
</button>
);
};
export default FullscreenToggle;