File tree Expand file tree Collapse file tree 4 files changed +35
-29
lines changed Expand file tree Collapse file tree 4 files changed +35
-29
lines changed Original file line number Diff line number Diff line change 1+ import { useState } from 'react' ;
12import './App.css' ;
23import About from './components/About' ;
34import Navbar from './components/Navbar' ;
45import Textform from './components/TextForm' ;
5- import Textform2 from './components/Textform2' ;
6+ import React from 'react' ;
7+
68
79let name = "vishwajit vm" ;
810function App ( ) {
11+ //dark mode functionality here
12+ const [ mode , setMode ] = useState ( 'light' ) ;
13+
14+ //toggleMode
15+ const toggleMode = ( ) => {
16+ if ( mode === 'light' ) {
17+ setMode ( "dark" )
18+ document . body . style . background = '#042743'
19+ }
20+ else {
21+ setMode ( "light" )
22+ document . body . style . background = 'white'
23+
24+ }
25+ }
926 return (
1027 < >
11- < Navbar title = "Bloging Page" aboutTitle = "About Us" > </ Navbar >
28+ < Navbar title = "Bloging Page" aboutTitle = "About Us" mode = { mode } toggleMode = { toggleMode } > </ Navbar >
1229 { /* <About /> */ }
1330 < div className = "container" >
14- < Textform heading = "Enter Text To View Transform" > </ Textform >
15- { /* <Textform2 Headings="EXPERIMENT ZONE"></Textform2> */ }
31+ < Textform heading = "Enter Text To View Transform" mode = { mode } > </ Textform >
1632 </ div >
1733 </ >
1834 ) ;
Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ import PropTypes from 'prop-types'
33
44
55export default function Navbar ( props ) {
6- return (
7- < nav className = " navbar navbar-expand-lg navbar-dark bg-dark" >
6+ return (
7+ < nav className = { ` navbar navbar-expand-lg navbar-${ props . mode } bg-${ props . mode } ` } >
88 < div className = "container-fluid" >
99 < a className = "navbar-brand" href = "#" > { props . title } </ a >
1010 < button className = "navbar-toggler" type = "button" data-bs-toggle = "collapse" data-bs-target = "#navbarSupportedContent" aria-controls = "navbarSupportedContent" aria-expanded = "false" aria-label = "Toggle navigation" >
@@ -20,10 +20,14 @@ export default function Navbar(props) {
2020 </ li >
2121
2222 </ ul >
23- < form className = "d-flex" >
23+ { /* <form className="d-flex">
2424 <input className="form-control me-2" type="search" placeholder="Search" aria-label="Search" />
2525 <button className="btn btn-outline-success" type="submit">Search</button>
26- </ form >
26+ </form> */ }
27+ < div className = { `form-check form-switch text-${ props . mode === 'light' ?'dark' :'light' } ` } >
28+ < input className = "form-check-input " onClick = { props . toggleMode } style = { { width : "45%" , padding : "12%" } } type = "checkbox" role = "switch" id = "flexSwitchCheckDefault" />
29+ < label className = "form-check-label " htmlFor = "flexSwitchCheckDefault" > Dark Mode</ label >
30+ </ div >
2731 </ div >
2832 </ div >
2933</ nav >
Original file line number Diff line number Diff line change @@ -97,10 +97,10 @@ export default function Textform(props) {
9797 }
9898 return (
9999 < >
100- < div className = 'contaner' >
101- < div className = "form-group text-dark " >
100+ < div className = 'contaner' style = { { color : props . mode === 'dark' ? 'white' : '#042743' } } >
101+ < div className = "form-group " >
102102 < label htmlFor = "exampleFormControlTextarea1" className = 'mt-5 mb-2' > < h2 > { props . heading } </ h2 > </ label >
103- < textarea className = "form-control" id = "Messagearea" value = { text } onChange = { handleOnChangeData } rows = "12" > </ textarea >
103+ < textarea className = "form-control" id = "Messagearea" value = { text } onChange = { handleOnChangeData } rows = "12" style = { { backgroundColor : props . mode === 'dark' ? 'gray' : 'white' , color : props . mode === 'dark' ? 'white' : '#042743' } } > </ textarea >
104104 </ div >
105105
106106 < button className = "btn btn-primary btn-block my-4 text-uppercase mx-3" onClick = { handleUpperCaseEvent } > uppercase </ button >
@@ -119,16 +119,16 @@ export default function Textform(props) {
119119
120120 </ div >
121121
122- < div className = "container text-dark my-3" >
122+ < div className = "container my-3" style = { { color : props . mode === 'dark' ? 'white' : '#042743' } } >
123123 < h1 className = 'text-danger' > Your Text Summery </ h1 >
124- < p >
125- < span className = 'text-danger' > { text . split ( " " ) . length } </ span > Words and < span className = 'text-danger' > { text . length } </ span > Characters < br />
124+ < p style = { { fontSize : "25px" } } >
125+ < span className = 'text-danger font-weight-bolder ' > { text . split ( " " ) . length } </ span > Words and < span className = 'text-danger' > { text . length } </ span > Characters < br />
126126 < span className = 'text-danger' > { 0.008 * text . split ( " " ) . length } </ span > Minutes Time to Read this by Words < br />
127127 < span className = 'text-danger' > { 0.002 * text . length } </ span > Minutes time to read by characters.
128128 </ p >
129129 < h2 > Preview</ h2 >
130130 < p >
131- { text }
131+ { text . length > 0 ? text : "Enter somthing to preview it here" }
132132 </ p >
133133 </ div >
134134 </ >
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments