Adds crafted items, weapon config, generally working
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ItemsById } from "../lib/items";
|
||||
import { ItemsById, itemsPerSlot } from "../lib/items";
|
||||
import type { State } from "../lib/state";
|
||||
import { Slots, type Item, type Slot } from "../lib/types";
|
||||
import { ItemLink } from "./ItemLink";
|
||||
@@ -12,16 +12,28 @@ export type Props = {
|
||||
onUnequip: (item: Item) => void;
|
||||
};
|
||||
|
||||
export const Equipment = ({ state, onEquip, onUnequip }: Props) => (
|
||||
<div>
|
||||
<ItemTypeahead value={null} onSelect={onEquip} />
|
||||
<div className={styles.equipedItems}>
|
||||
{Slots.map((slot) => (
|
||||
<Slot state={state} slot={slot} onUnequip={onUnequip} key={slot} />
|
||||
))}
|
||||
export const Equipment = ({ state, onEquip, onUnequip }: Props) => {
|
||||
return (
|
||||
<div>
|
||||
<ItemTypeahead value={null} onSelect={(item) => item && onEquip(item)} />
|
||||
<div className={styles.equipedItems}>
|
||||
{Slots.map((slot) => {
|
||||
if (itemsPerSlot(slot, state.weaponConfig) > 0) {
|
||||
return (
|
||||
<Slot
|
||||
state={state}
|
||||
slot={slot}
|
||||
onUnequip={onUnequip}
|
||||
key={slot}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
);
|
||||
};
|
||||
|
||||
type SlotProps = {
|
||||
state: State;
|
||||
|
||||
Reference in New Issue
Block a user