diff --git a/web/src/components/BanLandscape.tsx b/web/src/components/BanLandscape.tsx new file mode 100644 index 00000000..1bec3db5 --- /dev/null +++ b/web/src/components/BanLandscape.tsx @@ -0,0 +1,60 @@ +import { useCallback, useEffect, useState } from "react"; + +const BanLandscape = () => { + const [isLandscape, setIsLandscape] = useState(false); + + const checkOrientation = useCallback(() => { + const userAgent = navigator.userAgent; + const isMobile = /iPhone|Android|Mobile/i.test(userAgent); + if (isMobile) { + setIsLandscape(window.innerHeight < window.innerWidth); + } else { + setIsLandscape(false); // モバイルデバイスでない場合は常に縦画面扱い + } + }, []); + + useEffect(() => { + checkOrientation(); + window.addEventListener("resize", checkOrientation); + return () => { + window.removeEventListener("resize", checkOrientation); + }; + }, [checkOrientation]); + + return ( +
+ {isLandscape && ( +
+
+ このアプリは縦画面で使用してください +
+
+ )} +
+ ); +}; + +export default BanLandscape; diff --git a/web/src/components/Card.tsx b/web/src/components/Card.tsx index 6df18ad8..c01f670b 100644 --- a/web/src/components/Card.tsx +++ b/web/src/components/Card.tsx @@ -70,7 +70,7 @@ const CardFront = ({ displayedUser }: CardProps) => { border: "2px solid #3596C6", padding: "10px", height: "100%", - overflow: "scroll", + overflow: "hidden", }} >
{ border: "2px solid #3596C6", padding: "10px", height: "100%", - overflow: "scroll", + overflow: "hidden", }} >
diff --git a/web/src/components/DraggableCard.tsx b/web/src/components/DraggableCard.tsx index 604f381f..dc8d4e7c 100644 --- a/web/src/components/DraggableCard.tsx +++ b/web/src/components/DraggableCard.tsx @@ -69,6 +69,7 @@ export const DraggableCard = ({ handleDragEnd(); }} style={{ x: dragX, y: dragY, padding: "10px" }} + whileTap={{ scale: 0.95 }} > diff --git a/web/src/main.tsx b/web/src/main.tsx index 7c60b77c..56bfdaf8 100644 --- a/web/src/main.tsx +++ b/web/src/main.tsx @@ -7,6 +7,7 @@ import "@fontsource/roboto/500.css"; import "@fontsource/roboto/700.css"; import { CssBaseline } from "@mui/material"; import App from "./App"; +import BanLandscape from "./components/BanLandscape"; import { AlertProvider } from "./components/common/alert/AlertProvider"; import { ModalProvider } from "./components/common/modal/ModalProvider"; import AuthProvider from "./firebase/auth/AuthProvider"; @@ -19,6 +20,7 @@ ReactDOM.createRoot(root).render( +