import * as React from "react"; import { FunctionComponent } from "react"; import { getColorByBrightness } from "@mancala/core"; import { Context } from "../../context/context"; // A titled block of the home page; children are laid out as wrapping cards. const HomeSection: FunctionComponent<{ context: Context, title: string, emptyText?: string }> = (props) => { const theme = props.context.themeManager.theme; const textColor = getColorByBrightness(theme.background, theme.textColor, theme.textLightColor); const isEmpty = React.Children.count(props.children) === 0; return (

{props.title}

{isEmpty && props.emptyText ?

{props.emptyText}

:
{props.children}
}
); }; export default HomeSection;