playpause
This commit is contained in:
@@ -1,13 +1,27 @@
|
|||||||
|
"use client";
|
||||||
import "./style.css";
|
import "./style.css";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
export default function RootLayout({
|
export default function RootLayout({
|
||||||
children,
|
children,
|
||||||
}: {
|
}: {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}) {
|
}) {
|
||||||
|
const [isAnimate, setIsAnimate] = useState(false);
|
||||||
|
|
||||||
|
const toggleAnimation = () => {
|
||||||
|
setIsAnimate(!isAnimate);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<body className="bg-game-show animate h-screen">{children}</body>
|
<body className={`bg-game-show ${isAnimate ? "animate" : ""} h-screen`}>
|
||||||
|
{children}
|
||||||
|
<button
|
||||||
|
className={`absolute top-1 left-1 ${isAnimate ? "pause" : "play"}`}
|
||||||
|
onClick={toggleAnimation}
|
||||||
|
></button>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,3 +27,10 @@
|
|||||||
--angle: 30deg;
|
--angle: 30deg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.play:before {
|
||||||
|
content: "▶️";
|
||||||
|
}
|
||||||
|
.pause:before {
|
||||||
|
content: "⏸";
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user