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' ;
1
2
import './App.css' ;
2
3
import About from './components/About' ;
3
4
import Navbar from './components/Navbar' ;
4
5
import Textform from './components/TextForm' ;
5
- import Textform2 from './components/Textform2' ;
6
+ import React from 'react' ;
7
+
6
8
7
9
let name = "vishwajit vm" ;
8
10
function 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
+ }
9
26
return (
10
27
< >
11
- < Navbar title = "Bloging Page" aboutTitle = "About Us" > </ Navbar >
28
+ < Navbar title = "Bloging Page" aboutTitle = "About Us" mode = { mode } toggleMode = { toggleMode } > </ Navbar >
12
29
{ /* <About /> */ }
13
30
< 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 >
16
32
</ div >
17
33
</ >
18
34
) ;
Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ import PropTypes from 'prop-types'
3
3
4
4
5
5
export 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 } ` } >
8
8
< div className = "container-fluid" >
9
9
< a className = "navbar-brand" href = "#" > { props . title } </ a >
10
10
< 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) {
20
20
</ li >
21
21
22
22
</ ul >
23
- < form className = "d-flex" >
23
+ { /* <form className="d-flex">
24
24
<input className="form-control me-2" type="search" placeholder="Search" aria-label="Search" />
25
25
<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 >
27
31
</ div >
28
32
</ div >
29
33
</ nav >
Original file line number Diff line number Diff line change @@ -97,10 +97,10 @@ export default function Textform(props) {
97
97
}
98
98
return (
99
99
< >
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 " >
102
102
< 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 >
104
104
</ div >
105
105
106
106
< 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) {
119
119
120
120
</ div >
121
121
122
- < div className = "container text-dark my-3" >
122
+ < div className = "container my-3" style = { { color : props . mode === 'dark' ? 'white' : '#042743' } } >
123
123
< 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 />
126
126
< span className = 'text-danger' > { 0.008 * text . split ( " " ) . length } </ span > Minutes Time to Read this by Words < br />
127
127
< span className = 'text-danger' > { 0.002 * text . length } </ span > Minutes time to read by characters.
128
128
</ p >
129
129
< h2 > Preview</ h2 >
130
130
< p >
131
- { text }
131
+ { text . length > 0 ? text : "Enter somthing to preview it here" }
132
132
</ p >
133
133
</ div >
134
134
</ >
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments