Use ContextMenu in GameCard component
This commit is contained in:
parent
60370fc39f
commit
720cb79b31
|
|
@ -1,4 +1,5 @@
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
import ContextMenu, { Item } from '../ContextMenu';
|
||||||
import './index.css';
|
import './index.css';
|
||||||
|
|
||||||
import { Game } from "@renderer/types";
|
import { Game } from "@renderer/types";
|
||||||
|
|
@ -20,7 +21,23 @@ const GameCard = ({ title, path, is_running, img_cover, id, }: Game) => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
|
const items: Item[] = [
|
||||||
|
{
|
||||||
|
label: 'Details',
|
||||||
|
onClick: () =>
|
||||||
|
console.log('Details'),
|
||||||
|
show: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Details',
|
||||||
|
onClick: () =>
|
||||||
|
console.log('Details'),
|
||||||
|
show: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<ContextMenu items={items}>
|
||||||
<div className='gameCard' key={id} id={`${id}`}>
|
<div className='gameCard' key={id} id={`${id}`}>
|
||||||
<img src={"src/assets/" + img_cover} alt={title}/>
|
<img src={"src/assets/" + img_cover} alt={title}/>
|
||||||
<a href="#" className='hoverLink' onClick={() => startGame(id)}>
|
<a href="#" className='hoverLink' onClick={() => startGame(id)}>
|
||||||
|
|
@ -28,6 +45,7 @@ const GameCard = ({ title, path, is_running, img_cover, id, }: Game) => {
|
||||||
</a>
|
</a>
|
||||||
{status}
|
{status}
|
||||||
</div>
|
</div>
|
||||||
|
</ContextMenu>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue