imporved notif

This commit is contained in:
Quentin Roussel
2024-05-01 10:46:18 +02:00
parent b3f8bd939a
commit a6d18fb60f
2 changed files with 2 additions and 2 deletions

View File

@@ -39,11 +39,12 @@ export function Notification({ socket }) {
success: "bg-green-500", success: "bg-green-500",
warning: "bg-yellow-500" warning: "bg-yellow-500"
} }
const classNames = 'fixed w-11/12 p-5 z-30 mx-auto inset-x-0 flex justify-center rounded-xl transition-all shadow-xl ' + (visible ? "top-5 " : "-translate-y-full "); const classNames = 'fixed relative w-11/12 p-5 z-30 mx-auto inset-x-0 flex justify-center rounded-xl transition-all shadow-xl ' + (visible ? "top-5 " : "-translate-y-full ");
return ( return (
Object.keys(bgColorMap).map((key) => Object.keys(bgColorMap).map((key) =>
notification?.type == key && notification?.type == key &&
<div key={key} className={classNames + bgColorMap[key]} onClick={() => setVisible(false)}> <div key={key} className={classNames + bgColorMap[key]} onClick={() => setVisible(false)}>
<p className="absolute top-2 right-2 p-2 rounded-l text-3xl bg-white">x</p>
<p className='text-center text-xl'>{notification?.text}</p> <p className='text-center text-xl'>{notification?.text}</p>
</div> </div>
)); ));

View File

@@ -3,7 +3,6 @@
import { useSocket } from "@/context/socketContext"; import { useSocket } from "@/context/socketContext";
import { useTeamConnexion } from "@/context/teamConnexionContext"; import { useTeamConnexion } from "@/context/teamConnexionContext";
import { useTeamContext } from "@/context/teamContext"; import { useTeamContext } from "@/context/teamContext";
import { useEffect } from "react";
export default function useGame() { export default function useGame() {
const { teamSocket } = useSocket(); const { teamSocket } = useSocket();