Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes all issues #670

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading