silphius/app/react/components/dom/hotbar.jsx

36 lines
777 B
React
Raw Normal View History

2024-06-10 22:42:30 -05:00
import styles from './hotbar.module.css';
2024-07-28 08:06:08 -05:00
import gridStyles from './grid.module.css';
import Grid from './grid.jsx';
2024-06-10 22:42:30 -05:00
/**
* The hotbar. 10 slots of inventory with an active selection.
*/
2024-07-23 23:27:08 -05:00
export default function Hotbar({
active,
hotbarIsHidden,
onActivate,
slots,
}) {
2024-06-10 22:42:30 -05:00
return (
<div
className={styles.hotbar}
2024-07-28 08:06:08 -05:00
style={hotbarIsHidden ? {opacity: 0, top: '-50px'} : {transition: 'opacity 50ms'}}
2024-06-10 22:42:30 -05:00
>
2024-07-28 08:06:08 -05:00
<style>{`
.${styles.hotbar} .${gridStyles.label} {
text-align: center;
}
`}</style>
<Grid
active={active}
color="rgba(02, 02, 57, 0.6)"
columns={10}
label={slots[active] && slots[active].label}
onActivate={onActivate}
slots={slots}
/>
2024-06-10 22:42:30 -05:00
</div>
);
}