2019-03-29 08:12:41 +01:00
|
|
|
/**
|
|
|
|
* React Component for displaying a City's UI.
|
|
|
|
* This UI shows all of the available locations in the city, and lets the player
|
|
|
|
* visit those locations
|
|
|
|
*/
|
|
|
|
import * as React from "react";
|
|
|
|
|
|
|
|
import { City } from "../City";
|
|
|
|
import { LocationName } from "../data/LocationNames";
|
|
|
|
|
|
|
|
import { StdButton } from "../../ui/React/StdButton";
|
|
|
|
|
|
|
|
type IProps = {
|
|
|
|
city: City;
|
|
|
|
enterLocation: (to: LocationName) => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export class LocationCity extends React.Component<IProps, any> {
|
|
|
|
render() {
|
|
|
|
const locationButtons = this.props.city.locations.map((locName) => {
|
|
|
|
return (
|
2019-04-04 02:08:11 +02:00
|
|
|
<li key={locName}>
|
|
|
|
<StdButton onClick={this.props.enterLocation.bind(this, locName)} text={locName} />
|
2019-03-29 08:12:41 +01:00
|
|
|
</li>
|
|
|
|
)
|
|
|
|
});
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ul>
|
|
|
|
{locationButtons}
|
|
|
|
</ul>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|