import React from 'react' ; import { HealthBarState } from '..' ; import { EnemyHealthBar } from './EnemyHealthBar' ; import { FriendlyHealthBar } from './FriendlyHealthBar' ; import { ItemHealthBar } from './ItemHealthBar' ; export interface Props { state : HealthBarState ; } export function HealthBar ( props ) { switch ( props . state . kind ) { case HealthBarKind . EnemyPlayer : { return < EnemyHealthBar state = { props . state } />; } case HealthBarKind . FriendlyPlayer : { return < FriendlyHealthBar state = { props . state } />; } case HealthBarKind . Item : { return < ItemHealthBar state = { props . state } />; } default : { return null ; } } }