From 65f5f802e7ad03c0e59d96eac297ead7f9783482 Mon Sep 17 00:00:00 2001 From: Gerardo Marx Date: Thu, 4 Jun 2026 20:43:09 -0600 Subject: [PATCH] Excercise Alert --- src/App.tsx | 14 ++++++++++---- src/components/Alert.tsx | 7 +++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index d8822ef..cfc59c7 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,16 +1,22 @@ +import { useState } from "react"; +import Alert from "./components/Alert"; import { Button } from "./components/Button"; -function handleOnClick() { - console.log("Clicked"); -} + +// function handleOnClick() { +// //console.log("Clicked"); +// } function App() { + const [alertVisible, setAlertVisibility] = useState(false); return (
- + {alertVisible && setAlertVisibility(false)}>Holly wacamole!} + +
); } diff --git a/src/components/Alert.tsx b/src/components/Alert.tsx index 708970d..31c4b04 100644 --- a/src/components/Alert.tsx +++ b/src/components/Alert.tsx @@ -2,11 +2,14 @@ import type { ReactNode } from "react"; interface Props{ children: ReactNode; + onClose:()=>void; } -function Alert({children} : Props) { +function Alert({children, onClose} : Props) { return ( -
{children}
+
{children} + +
) }