Skip to content

Commit

Permalink
Merge pull request #670 from zalabhavy/fix
Browse files Browse the repository at this point in the history
Fixes all issues
  • Loading branch information
mdazfar2 authored Jun 26, 2024
2 parents df29f2d + bd6b852 commit 7dc54ef
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
3 changes: 2 additions & 1 deletion website3.0/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ const Header = () => {
<div className="nav-actions">
<a href="https://github.com/sponsors/mdazfar2" target="_blank">
<button className="nav-sponsor-btn">
Sponsor <FontAwesomeIcon icon={faHeart} id="heart" width={25} />
<FontAwesomeIcon icon={faHeart} id="heart" width={25} />
Sponsor
</button>
</a>
<ToggleSwitch />
Expand Down
17 changes: 9 additions & 8 deletions website3.0/components/ToggleSwitch.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { useState, useEffect } from "react";
import "@stylesheets/darkmode.css";

//Importing FontAwesome for Icons
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faMoon } from "@fortawesome/free-regular-svg-icons";

Expand All @@ -19,22 +17,26 @@ const ToggleSwitch = () => {
document.body.classList.remove("dark-mode");
}
}, []);

// Function to toggle dark mode
const toggleMode = () => {
const newMode = !isDarkMode;
// Update state with new mode
setIsDarkMode(newMode);
// Toggle dark mode class on body
document.body.classList.toggle("dark-mode");
if (newMode) {
document.body.classList.add("dark-mode");
} else {
document.body.classList.remove("dark-mode");
}
// Store new mode preference in local storage
localStorage.setItem("dark-mode", newMode);
localStorage.setItem("dark-mode", newMode.toString());
};

return (
<div className="toggle-switch">
<button className={`nav-sponsor-btn ${isDarkMode ? 'dark-mode' : ''}`} onClick={toggleMode} style={{ height: '45px', width: '45px', borderRadius: '15px' }}>
{isDarkMode ? (
<svg
onClick={toggleMode}
id="sun"
className="sun1 size-6"
viewBox="0 0 24 24"
Expand All @@ -50,12 +52,11 @@ const ToggleSwitch = () => {
) : (
<FontAwesomeIcon
icon={faMoon}
onClick={toggleMode}
width={25}
className="moon"
/>
)}
</div>
</button>
);
};

Expand Down
2 changes: 1 addition & 1 deletion website3.0/pages/HomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ function HomePage() {
<li className="isDisplay">
<a href="https://github.com/sponsors/mdazfar2" target="_blank">
<h3 className="home-sponsor-btn">
Sponsor{" "}
<FontAwesomeIcon icon={faHeart} id="heart" width={25} />
Sponsor{" "}
</h3>
</a>
</li>
Expand Down
4 changes: 2 additions & 2 deletions website3.0/stylesheets/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ nav {
.nav-sponsor-btn {
background-color: rgba(245, 245, 245, 0.788);
border: none;
border-radius: 25px;
border-radius: 15px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
color: #000000;
font-size: 20px;
Expand All @@ -102,7 +102,7 @@ nav {
}

#heart {
color: rgba(255, 0, 0, 0.84);
color: rgb(234, 139, 155); ;
}
.nav-sponsor-btn:active {
transform: translateY(1px);
Expand Down
2 changes: 1 addition & 1 deletion website3.0/stylesheets/homepage.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ a {
}

#heart {
color: red;
color: rgb(234, 139, 155);
}

.main-content {
Expand Down

0 comments on commit 7dc54ef

Please sign in to comment.