mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-10-23 10:13:13 +02:00
35 lines
888 B
TypeScript
35 lines
888 B
TypeScript
|
/**
|
||
|
* 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 (
|
||
|
<li>
|
||
|
<StdButton onClick={this.props.enterLocation.bind(this, locName)} text={locName} key={locName} />
|
||
|
</li>
|
||
|
)
|
||
|
});
|
||
|
|
||
|
return (
|
||
|
<ul>
|
||
|
{locationButtons}
|
||
|
</ul>
|
||
|
)
|
||
|
}
|
||
|
}
|