Skip to content

Commit e9da93f

Browse files
committed
Added New Feture for Enabling dark and light Mode at about us section
1 parent 1e17c99 commit e9da93f

File tree

4 files changed

+85
-3
lines changed

4 files changed

+85
-3
lines changed

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<!-- Bootstrap CSS -->
1616
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
1717
</head>
18-
<body class="bg-dark">
18+
<body class="">
1919
<noscript>You need to enable JavaScript to run this app.</noscript>
2020
<div id="root"></div>
2121

src/App.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import './App.css';
2+
import About from './components/About';
23
import Navbar from './components/Navbar';
34
import Textform from './components/TextForm';
45
import Textform2 from './components/Textform2' ;
@@ -8,6 +9,7 @@ function App() {
89
return (
910
<>
1011
<Navbar title="Bloging Page" aboutTitle="About Us"></Navbar>
12+
<About />
1113
<div className="container">
1214
<Textform heading="Enter Text To View Transform"></Textform>
1315
{/* <Textform2 Headings="EXPERIMENT ZONE"></Textform2> */}

src/components/About.js

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import React , {useState} from 'react'
2+
3+
export default function About() {
4+
const [mystyle , setMyStyle] = useState({
5+
color: 'white' ,
6+
backgroundColor: '#211b1b'
7+
}) ;
8+
9+
//change text
10+
const [btntext , setBtnText] = useState("Enable Light Mode")
11+
12+
const toggleStyle = (event)=>{
13+
if(mystyle.color == 'white') {
14+
setMyStyle({
15+
color: 'black' ,
16+
backgroundColor: 'white'
17+
})
18+
setBtnText("Enable Dark Mode")
19+
}
20+
else{
21+
setMyStyle({
22+
color: 'white' ,
23+
backgroundColor: '#211b1b'
24+
})
25+
setBtnText("Enable Light Mode")
26+
27+
}
28+
}
29+
30+
31+
return (
32+
<div className='container my-5' style={mystyle}>
33+
<h1 className='py-3'> About </h1>
34+
<div className="accordion" id="accordionExample">
35+
<div className="accordion-item">
36+
<h2 className="accordion-header" id="headingOne">
37+
<button className="accordion-button" style={mystyle} type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
38+
Accordion Item #1
39+
</button>
40+
</h2>
41+
<div id="collapseOne" className="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#accordionExample">
42+
<div className="accordion-body" style={mystyle}>
43+
<strong>This is the first item's accordion body.</strong> It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
44+
</div>
45+
</div>
46+
</div>
47+
48+
<div className="accordion-item">
49+
<h2 className="accordion-header" id="headingTwo">
50+
<button className="accordion-button collapsed" style={mystyle} type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
51+
Accordion Item #2
52+
</button>
53+
</h2>
54+
<div id="collapseTwo" className="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#accordionExample">
55+
<div className="accordion-body" style={mystyle}>
56+
<strong>This is the second item's accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
57+
</div>
58+
</div>
59+
</div>
60+
61+
<div className="accordion-item">
62+
<h2 className="accordion-header" id="headingThree">
63+
<button className="accordion-button collapsed" style={mystyle} type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
64+
Accordion Item #3
65+
</button>
66+
</h2>
67+
<div id="collapseThree" className="accordion-collapse collapse" aria-labelledby="headingThree" data-bs-parent="#accordionExample">
68+
<div className="accordion-body" style={mystyle}>
69+
<strong>This is the third item's accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
70+
</div>
71+
</div>
72+
</div>
73+
74+
</div>
75+
<div className="container">
76+
<button onClick={toggleStyle} className="btn btn-danger btn-lg my-3"> {btntext} </button>
77+
</div>
78+
</div>
79+
)
80+
}

src/components/TextForm.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export default function Textform(props) {
9898
return (
9999
<>
100100
<div className='contaner'>
101-
<div className="form-group text-light">
101+
<div className="form-group text-dark">
102102
<label htmlFor="exampleFormControlTextarea1" className='mt-5 mb-2'> <h2> {props.heading} </h2> </label>
103103
<textarea className="form-control" id="Messagearea" value={text} onChange={handleOnChangeData} rows="12"></textarea>
104104
</div>
@@ -119,7 +119,7 @@ export default function Textform(props) {
119119

120120
</div>
121121

122-
<div className="container text-light my-3">
122+
<div className="container text-dark my-3">
123123
<h1 className='text-danger'> Your Text Summery </h1>
124124
<p>
125125
<span className='text-danger'> {text.split(" ").length} </span> Words and <span className='text-danger'> {text.length} </span> Characters <br />

0 commit comments

Comments
 (0)