From 2942a550d9f642bcb10df231b71440972667cdb0 Mon Sep 17 00:00:00 2001 From: vishwajit vm <35070025+vishwajitvm@users.noreply.github.com> Date: Thu, 21 Apr 2022 00:30:23 +0530 Subject: [PATCH] Improving Dark Mode & Refactoring App Component --- src/App.js | 24 ++++++++++++++++++++---- src/components/Navbar.js | 12 ++++++++---- src/components/TextForm.js | 14 +++++++------- src/components/Textform2.js | 14 -------------- 4 files changed, 35 insertions(+), 29 deletions(-) delete mode 100644 src/components/Textform2.js diff --git a/src/App.js b/src/App.js index 5a6cfc2..ea44fee 100644 --- a/src/App.js +++ b/src/App.js @@ -1,18 +1,34 @@ +import { useState } from 'react'; import './App.css'; import About from './components/About'; import Navbar from './components/Navbar'; import Textform from './components/TextForm'; -import Textform2 from './components/Textform2' ; +import React from 'react' ; + let name = "vishwajit vm" ; function App() { + //dark mode functionality here + const [mode , setMode] = useState('light') ; + + //toggleMode + const toggleMode = ()=>{ + if(mode === 'light') { + setMode("dark") + document.body.style.background = '#042743' + } + else{ + setMode( "light") + document.body.style.background = 'white' + + } + } return ( <> - + {/* */}
- - {/* */} +
); diff --git a/src/components/Navbar.js b/src/components/Navbar.js index be74a2c..af0e07d 100644 --- a/src/components/Navbar.js +++ b/src/components/Navbar.js @@ -3,8 +3,8 @@ import PropTypes from 'prop-types' export default function Navbar(props) { - return ( -