Inventory
parent
ffb28e60a8
commit
811207dc87
@ -0,0 +1,21 @@
|
||||
import React from 'react'
|
||||
|
||||
import styles from './Inventory.module.css'
|
||||
import useGameState from '../../hooks/useGameState'
|
||||
|
||||
export default function () {
|
||||
const state = useGameState()
|
||||
|
||||
const allItems = Array.from(state.items.values())
|
||||
const inventory = allItems.filter(({location}) => location === 'inventory')
|
||||
|
||||
return (
|
||||
<>
|
||||
<h3>You have:</h3>
|
||||
<ul className={styles.list}>
|
||||
{inventory.map(item => (<li>{item.name}</li>))}
|
||||
{inventory.length === 0 && (<li>Nothing</li>)}
|
||||
</ul>
|
||||
</>
|
||||
)
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
.list {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.list li::before {
|
||||
content: '-';
|
||||
margin-left: -20px;
|
||||
margin-right: 10px;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
import React from 'react'
|
||||
|
||||
export default function () {
|
||||
return (
|
||||
<>
|
||||
<ul>
|
||||
<li>Nothing</li>
|
||||
</ul>
|
||||
</>
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue