From 2b643a0978d173a5ce997ef7c138f33aed6e2ba7 Mon Sep 17 00:00:00 2001 From: Cristian Yancis Date: Mon, 9 Sep 2024 11:35:42 -0600 Subject: [PATCH] app terminada --- .vscode/settings.json | 22 ---------------- app/cuadros.js | 7 +++-- app/globals.css | 53 ++++++++++++++++++++++++++++++++++++++ app/page.jsx | 11 +++++--- app/tablero.js | 57 ++++++++++++++++++++++++++++++++++------- conponent/Alert.js | 28 ++++++++++++++++++++ context/AlertWrapper.js | 29 +++++++++++++++++++++ 7 files changed, 168 insertions(+), 39 deletions(-) delete mode 100644 .vscode/settings.json create mode 100644 conponent/Alert.js create mode 100644 context/AlertWrapper.js diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 108b8bd..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "workbench.colorCustomizations": { - "activityBar.activeBackground": "#4e3b40", - "activityBar.background": "#4e3b40", - "activityBar.foreground": "#e7e7e7", - "activityBar.inactiveForeground": "#e7e7e799", - "activityBarBadge.background": "#000000", - "activityBarBadge.foreground": "#e7e7e7", - "commandCenter.border": "#e7e7e799", - "sash.hoverBorder": "#4e3b40", - "statusBar.background": "#312528", - "statusBar.foreground": "#e7e7e7", - "statusBarItem.hoverBackground": "#4e3b40", - "statusBarItem.remoteBackground": "#312528", - "statusBarItem.remoteForeground": "#e7e7e7", - "titleBar.activeBackground": "#312528", - "titleBar.activeForeground": "#e7e7e7", - "titleBar.inactiveBackground": "#31252899", - "titleBar.inactiveForeground": "#e7e7e799" - }, - "peacock.color": "#312528" -} \ No newline at end of file diff --git a/app/cuadros.js b/app/cuadros.js index 0bc737d..0ae56aa 100644 --- a/app/cuadros.js +++ b/app/cuadros.js @@ -1,6 +1,6 @@ import { useState } from "react"; -const Cuadrado = ({ valor, alHcerClick }) => { +const Cuadrado = ({ valor, alHacerClick }) => { const [showMenu, setShowMenu] = useState(false); const handleMouseEnter = () => { @@ -8,7 +8,6 @@ const Cuadrado = ({ valor, alHcerClick }) => { }; const handleMouseLeave = () => { - setTimeout(() => { if (!document.querySelector('.menu')?.contains(document.activeElement)) { setShowMenu(false); @@ -17,7 +16,7 @@ const Cuadrado = ({ valor, alHcerClick }) => { }; const handleSelect = (valor) => { - alHcerClick(valor); + alHacerClick(valor); setShowMenu(false); }; @@ -28,7 +27,7 @@ const Cuadrado = ({ valor, alHcerClick }) => { onMouseLeave={handleMouseLeave} > + +
+ {mensaje} +
+ + + } + + ); +}; + +export default Alert; diff --git a/context/AlertWrapper.js b/context/AlertWrapper.js new file mode 100644 index 0000000..584ae29 --- /dev/null +++ b/context/AlertWrapper.js @@ -0,0 +1,29 @@ +'use client'; +import { createContext, useState } from "react"; +import Alert from "@/conponent/Alert"; + +export const Alertconstext = createContext(); + +const AlertProvider = ({ children }) => { + const [viuwAlert, setViuwAlert] = useState(false); + const [titulo, setTitulo] = useState('Alerta'); + const [mensaje, setMensaje] = useState(''); + + const AlertWrapper = { + show: (titulo = 'Alerta', mensaje) => { + setTitulo(titulo); + setMensaje(mensaje); + setViuwAlert(true); + }, + hide: () => setViuwAlert(false) + } + + return ( + + {children} + + + ) +}; + +export default AlertProvider;