diff --git a/src/App.tsx b/src/App.tsx
index 1dfc9c0..c4402bf 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,16 +1,20 @@
-import React from 'react';
-import CssBaseline from '@material-ui/core/CssBaseline';
-import { Router, Link } from "@reach/router"
-import { Home } from './pages/home';
-
+import React from "react";
+import CssBaseline from "@material-ui/core/CssBaseline";
+import Container from "@material-ui/core/Container";
+import { Router, Link } from "@reach/router";
+import { Home } from "./pages/home";
+import { Room } from "./pages/room";
function App() {
return (
<>
-
-
-
+
+
+
+
+
+
>
);
}
diff --git a/src/components/Spinner.module.css b/src/components/Spinner.module.css
new file mode 100644
index 0000000..366046c
--- /dev/null
+++ b/src/components/Spinner.module.css
@@ -0,0 +1,5 @@
+.center {
+ display: flex;
+ flex-flow: column;
+ align-items: center;
+}
diff --git a/src/components/Spinner.tsx b/src/components/Spinner.tsx
new file mode 100644
index 0000000..c50f265
--- /dev/null
+++ b/src/components/Spinner.tsx
@@ -0,0 +1,19 @@
+import React from "react";
+import Typography from "@material-ui/core/Typography";
+import Button from "@material-ui/core/Button";
+import Box from "@material-ui/core/Box";
+import styles from "./Spinner.module.css";
+
+export const Spinner: React.SFC<{ value?: String; onClick: () => void; isSpinning: boolean}> = ({ onClick, isSpinning, value }) => {
+ const spinText = isSpinning ? "Spinning" : value;
+ return (
+
+
+ Spinner: {spinText}
+
+
+
+ );
+}
diff --git a/src/models/Spinner.tsx b/src/models/Spinner.tsx
index d949cab..853f372 100644
--- a/src/models/Spinner.tsx
+++ b/src/models/Spinner.tsx
@@ -1,23 +1,37 @@
export interface ISpinnerItem {
value: Number,
color: "Black" | "Red",
- isMoneyCard?: Boolean
+ isMoneyCard?: Boolean;
+ toString: () => String;
+}
+
+export class SpinnerItem implements ISpinnerItem {
+ value: Number;
+ color: "Black" | "Red";
+ isMoneyCard?: Boolean | undefined;
+ constructor(value: Number, color: "Black" | "Red", isMoneyCard?: Boolean) {
+ this.value = value;
+ this.color = color;
+ }
+ toString() {
+ return this.isMoneyCard ? `Money Card!` : `${this.value} ${this.color}`;
+ }
}
export class Spinner {
spinnerOptions: Array = [
- { value: 4, color: "Black", },
- { value: 2, color: "Red", },
- { value: 1, color: "Black", },
- { value: 3, color: "Red", },
- { value: 5, color: "Black", },
- { value: 2, color: "Red", },
- { value: 4, color: "Black", },
- { value: 3, color: "Red", },
- { value: 1, color: "Black", },
- { value: 5, color: "Red", isMoneyCard: true }
+ new SpinnerItem(4, "Black"),
+ new SpinnerItem(2, "Red"),
+ new SpinnerItem(1, "Black"),
+ new SpinnerItem(3, "Red"),
+ new SpinnerItem(5, "Black"),
+ new SpinnerItem(2, "Red"),
+ new SpinnerItem(4, "Black"),
+ new SpinnerItem(3, "Red"),
+ new SpinnerItem(1, "Black"),
+ new SpinnerItem(5, "Red", true)
]
spin () {
return this.spinnerOptions[Math.floor(Math.random() * this.spinnerOptions.length)];
}
-}
\ No newline at end of file
+}
diff --git a/src/pages/room.tsx b/src/pages/room.tsx
new file mode 100644
index 0000000..ecd8987
--- /dev/null
+++ b/src/pages/room.tsx
@@ -0,0 +1,21 @@
+import React, { useState } from 'react';
+import { RouteComponentProps } from "@reach/router"
+import Typography from '@material-ui/core/Typography';
+import { Spinner } from '../components/Spinner';
+import { Spinner as SpinnerModel, ISpinnerItem } from "../models/Spinner";
+
+const spinnerSingleton = new SpinnerModel();
+
+export function Room (props: RouteComponentProps<{id: Number}>) {
+ const [isSpinning, setIsSpinning] = useState(false);
+ const [spinValue, setSpinValue] = useState(null);
+ return (
+ {
+ setIsSpinning(true);
+ setTimeout(() => {
+ setIsSpinning(false);
+ setSpinValue(spinnerSingleton.spin())
+ },1500);
+ }} />
+ );
+}
diff --git a/src/pages/store/firebase.tsx b/src/store/firebase.tsx
similarity index 100%
rename from src/pages/store/firebase.tsx
rename to src/store/firebase.tsx