|
| 1 | +import React, {useState} from 'react' |
| 2 | + |
| 3 | +export default function About() { |
| 4 | + |
| 5 | + const [myStyle, setMyStyle] = useState({ |
| 6 | + color: 'black', |
| 7 | + backgroundColor: 'white' |
| 8 | + }) |
| 9 | + const [btntext, setBtnText] = useState("Enable Dark Mode") |
| 10 | + |
| 11 | + const toggleStyle = ()=>{ |
| 12 | + if(myStyle.color === 'black'){ |
| 13 | + setMyStyle({ |
| 14 | + color: 'white', |
| 15 | + backgroundColor: 'black', |
| 16 | + border: '1px solid white' |
| 17 | + |
| 18 | + }) |
| 19 | + setBtnText("Enable Light Mode") |
| 20 | + } |
| 21 | + else{ |
| 22 | + setMyStyle({ |
| 23 | + color: 'black', |
| 24 | + backgroundColor: 'white' |
| 25 | + }) |
| 26 | + setBtnText("Enable Dark Mode"); |
| 27 | + } |
| 28 | + } |
| 29 | + |
| 30 | + return ( |
| 31 | + <div className="container" style={myStyle}> |
| 32 | + <h1 className="my-3">About Us</h1> |
| 33 | + <div className="accordion" id="accordionExample"> |
| 34 | + <div className="accordion-item"> |
| 35 | + <h2 className="accordion-header" id="headingOne"> |
| 36 | + <button className="accordion-button" type="button" style={myStyle} data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> |
| 37 | + Accordion Item #1 |
| 38 | + </button> |
| 39 | + </h2> |
| 40 | + <div id="collapseOne" className="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#accordionExample"> |
| 41 | + <div className="accordion-body" style={myStyle}> |
| 42 | + <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. |
| 43 | + </div> |
| 44 | + </div> |
| 45 | + </div> |
| 46 | + <div className="accordion-item" style={myStyle}> |
| 47 | + <h2 className="accordion-header" id="headingTwo"> |
| 48 | + <button className="accordion-button collapsed" style={myStyle} type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"> |
| 49 | + Accordion Item #2 |
| 50 | + </button> |
| 51 | + </h2> |
| 52 | + <div id="collapseTwo" className="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#accordionExample"> |
| 53 | + <div className="accordion-body" style={myStyle}> |
| 54 | + <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. |
| 55 | + </div> |
| 56 | + </div> |
| 57 | + </div> |
| 58 | + <div className="accordion-item"> |
| 59 | + <h2 className="accordion-header" id="headingThree"> |
| 60 | + <button className="accordion-button collapsed" style={myStyle} type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree"> |
| 61 | + Accordion Item #3 |
| 62 | + </button> |
| 63 | + </h2> |
| 64 | + <div id="collapseThree" className="accordion-collapse collapse" aria-labelledby="headingThree" data-bs-parent="#accordionExample"> |
| 65 | + <div className="accordion-body" style={myStyle}> |
| 66 | + <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. |
| 67 | + </div> |
| 68 | + </div> |
| 69 | + </div> |
| 70 | + </div> |
| 71 | + <div className="container my-3"> |
| 72 | + <button onClick={toggleStyle} type="button" className="btn btn-primary">{btntext}</button> |
| 73 | + </div> |
| 74 | + </div> |
| 75 | + ) |
| 76 | +} |
0 commit comments