diff --git a/src/components/HeaderBar.tsx b/src/components/HeaderBar.tsx index d1bdc24..826c4c2 100644 --- a/src/components/HeaderBar.tsx +++ b/src/components/HeaderBar.tsx @@ -1,79 +1,10 @@ import * as React from "react"; -import { FunctionComponent } from "react"; -import { Menu, MenuItem } from "@szhsin/react-menu"; -import { MancalaGame } from "mancala.js"; -import { Context } from "../context/context"; -import { getColorByBrightness } from "../util/ColorUtil"; -import Button from "./Button"; -import "@szhsin/react-menu/dist/index.css"; -import "@szhsin/react-menu/dist/transitions/slide.css"; -import HeaderbarIcon from "./headerbar/HeaderbarIcon"; -import HeaderbarTitle from "./headerbar/HeaderbarTitle"; -import Row from "./Row"; -import ThemeSwitchMenu from "./headerbar/ThemeSwitchMenu"; +import { FunctionComponent } from "react";; -function renderNewGameButton( - context: Context, - game: MancalaGame | undefined, - onNewGameClick: () => void, - userKeyWhoLeave: string | undefined, - crashMessage: string | undefined): JSX.Element { - const newGame = ( - - ); - if (userKeyWhoLeave) { - return newGame; - } - if (crashMessage) { - return newGame; - } - if (!game) { - return newGame; - } else if (game.state == "ended") { - return newGame; - } - return <>>; -}; - -const HeaderBar: FunctionComponent<{ - context: Context, - game?: MancalaGame, - userKeyWhoLeave?: string, - crashMessage?: string, - onNewGameClick: () => void, - onLeaveGameClick: () => void -}> = (props) => { - const { context, game, userKeyWhoLeave, crashMessage, onNewGameClick, onLeaveGameClick } = props; - const textColor = getColorByBrightness( - context.themeManager.theme.appBarBgColor, - context.themeManager.theme.textColor, - context.themeManager.theme.textLightColor - ); +const HeaderBar: FunctionComponent<{ color?: string }> = ({children, color }) => { return ( -