From 44aaddf1533ab41738875283767b62ad8693c4e7 Mon Sep 17 00:00:00 2001 From: Pankajpensia <110286931+Pankajpensia@users.noreply.github.com> Date: Fri, 18 Aug 2023 12:45:39 +0530 Subject: [PATCH] Update App.js --- src/App.js | 61 ------------------------------------------------------ 1 file changed, 61 deletions(-) diff --git a/src/App.js b/src/App.js index ed583f4..8b13789 100644 --- a/src/App.js +++ b/src/App.js @@ -1,62 +1 @@ -import './App.css'; -import Navbar from './components/Navbar'; -import TextForm from './components/TextForm'; -import About from './components/About'; -import React, { useState } from 'react'; -import Alert from './components/Alert'; -import { - BrowserRouter as Router, - Switch, - Route -} from "react-router-dom"; - -function App() { - const [mode, setMode] = useState('light'); // Whether dark mode is enabled or not - const [alert, setAlert] = useState(null); - - const showAlert = (message, type)=>{ - setAlert({ - msg: message, - type: type - }) - setTimeout(() => { - setAlert(null); - }, 1500); - } - - const toggleMode = ()=>{ - if(mode === 'light'){ - setMode('dark'); - document.body.style.backgroundColor = '#042743'; - showAlert("Dark mode has been enabled", "success"); - } - else{ - setMode('light'); - document.body.style.backgroundColor = 'white'; - showAlert("Light mode has been enabled", "success"); - } - } - return ( - <> - - - -
- - {/* /users --> Component 1 - /users/home --> Component 2 */} - - - - - - - -
-
- - ); -} - -export default App; \ No newline at end of file