Skip to content

Commit

Permalink
Merge pull request #140 from Lodestone-Team/111-add-tooltip-to-gameic…
Browse files Browse the repository at this point in the history
…on-component

Add tooltip to GameIcon component
  • Loading branch information
ViridianCitrus authored Feb 11, 2023
2 parents 262dbf3 + 6445aa1 commit 7fd5306
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/components/Atoms/GameIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Tooltip from 'rc-tooltip';

const game_icons: { [key: string]: { [key: string]: string } } = {
minecraft: {
vanilla: '/assets/minecraft-vanilla.png',
Expand All @@ -21,10 +23,20 @@ export default function GameIcon({
if (game_flavour in game_icons[game_type])
icon = game_icons[game_type][game_flavour];
return (
<img
<Tooltip
showArrow={false}
overlay={<span>{
game_type.charAt(0).toUpperCase() + game_type.slice(1)} - {game_flavour.charAt(0).toUpperCase() + game_flavour.slice(1)
}</span>}
placement="bottom"
trigger={['hover']}
mouseEnterDelay={0.2}
>
<img
src={icon}
alt={game_type}
className={`${className}`}
/>
</Tooltip>
);
}

0 comments on commit 7fd5306

Please sign in to comment.