Commit d2df3ef1 authored by Benjamín Balun's avatar Benjamín Balun
Browse files

basic modal functionality added

parent 81c29d30
......@@ -12,6 +12,12 @@ const Store = () => {
usePageTitle('Store');
const { userData } = useLoggedInUser();
const [selectedItem, setSelectedItem] = useState<Food | Pokeball>();
const isModalVisible = useMemo(
() => selectedItem !== undefined,
[selectedItem]
);
if (!userData) {
return <Loading />;
}
......@@ -41,11 +47,21 @@ const Store = () => {
<p>
Price: {item.price} <DollarOutlined />
</p>
<Button type="primary">Buy</Button>
<Button type="primary" onClick={() => setSelectedItem(item)}>
Buy
</Button>
</Card>
</Col>
))}
</Row>
<Modal
title="Confirm purchase"
visible={isModalVisible}
onOk={() => setSelectedItem(undefined)}
onCancel={() => setSelectedItem(undefined)}
>
Are you sure that you want to buy {selectedItem?.name}?
</Modal>
</>
);
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment