diff --git a/.eslintrc b/.eslintrc
index a4fb2cd..097ec8f 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -9,6 +9,10 @@
],
"rules": {
"semi": 0,
+ "jsx-a11y/click-events-have-key-events": 0,
+ "jsx-a11y/no-static-element-interactions": 0,
+ "import/prefer-default-export": 0,
+ "react/no-array-index-key": 0,
"react/react-in-jsx-scope": 0,
"react/jsx-filename-extension": [
1,
diff --git a/src/App.js b/src/App.js
index e9f34aa..517f16a 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,23 +1,10 @@
-import logo from "./logo.svg";
+import { CubeFace } from "./CubeFace";
import "./App.css";
function App() {
return (
);
}
diff --git a/src/CubeFace.js b/src/CubeFace.js
new file mode 100644
index 0000000..8af4776
--- /dev/null
+++ b/src/CubeFace.js
@@ -0,0 +1,55 @@
+import { useState } from "react";
+
+const COLORS = ["green", "blue", "yellow", "orange", "white", "red"];
+
+export const CubeFace = () => {
+ const [squareColors, setSquareColor] = useState(
+ Array.from(Array(9).keys()).map(() => COLORS[Math.floor(Math.random() * 6)])
+ );
+ const [gameState, setGameState] = useState(0);
+
+ return (
+ <>
+ {gameState === 1 && (
+
+ Congratulations!{" "}
+
+
+ )}
+
+ {squareColors.map((c, k) => (
+
{
+ squareColors[k] = COLORS[(COLORS.indexOf(c) + 1) % 6];
+ setSquareColor([...squareColors]);
+ if (squareColors.every((val) => val === squareColors[0])) {
+ setGameState(1);
+ }
+ }}
+ style={{ backgroundColor: c, width: "200px", height: "200px" }}
+ />
+ ))}
+
+ >
+ );
+};