'use client';
import { useRef } from 'react';
import { Button } from './ui/button';
import clsx from 'clsx';
type GodotAppProps = {
url: string;
portrait?: boolean;
};
const GodotApp = ({ url, portrait = false }: GodotAppProps) => {
const appRef = useRef<HTMLIFrameElement>(null);
const focusApp = () => {
appRef.current?.requestFullscreen();
};
return (
<div className="mx-auto flex w-full max-w-3xl flex-col items-center justify-center space-y-4">
<iframe
ref={appRef}
src={url}
className={clsx(
'w-full rounded border-8',
portrait ? 'h-[560px] w-[380px]' : 'h-[440px]',
)}
autoFocus={false}
/>
<Button onClick={focusApp}>フルスクリーン</Button>
</div>
);
};
export default GodotApp;