Skip to content

Commit

Permalink
Merge pull request #98 from thevijayshankersharma/Dark-mode-toggle
Browse files Browse the repository at this point in the history
Added dark mode toggle
  • Loading branch information
Sahil1786 authored May 19, 2024
2 parents 8bd2b29 + 8531b9f commit 4b2ad23
Show file tree
Hide file tree
Showing 10 changed files with 539 additions and 225 deletions.
47 changes: 47 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# **Contributing Guidelines** 📄

This documentation contains a set of guidelines to help you during the contribution process.
We are happy to welcome all the contributions from anyone willing to improve/add new scripts to this project.
Thank you for helping out and remember, **no contribution is too small.**
<br>
Please note we have a [code of conduct](CODE_OF_CONDUCT.md) please follow it in all your interactions with the project.



<br>

## **Need some help regarding the basics?🤔**


You can refer to the following articles on basics of Git and Github and also contact the Project Mentors,
in case you are stuck:

- [Forking a Repo](https://help.github.com/en/github/getting-started-with-github/fork-a-repo)
- [Cloning a Repo](https://help.github.com/en/desktop/contributing-to-projects/creating-an-issue-or-pull-request)
- [How to create a Pull Request](https://opensource.com/article/19/7/create-pull-request-github)
- [Getting started with Git and GitHub](https://towardsdatascience.com/getting-started-with-git-and-github-6fcd0f2d4ac6)
- [Learn GitHub from Scratch](https://docs.github.com/en/get-started/start-your-journey/git-and-github-learning-resources)

<br>

## **Issue Report Process 📌**

1. Go to the project's issues.
2. Give proper description for the issues.
3. Don't spam to get the assignment of the issue 😀.
4. Wait for till someone is looking into it !.
5. Start working on issue only after you got assigned that issue 🚀.

<br>

## **Pull Request Process 🚀**

1. Ensure that you have self reviewed your code 😀
2. Make sure you have added the proper description for the functionality of the code
3. I have commented my code, particularly in hard-to-understand areas.
4. Add screenshot it help in review.
5. Submit your PR by giving the necesarry information in PR template and hang tight we will review it really soon 🚀

<br>

# **Thank you for contributing💗**
404 changes: 204 additions & 200 deletions package-lock.json

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions public/css/admin_css.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,46 @@ body{
background: #ececec;
}

/* Dark Mode */

.dark-mode {
background-color: #121212;
color: #e0e0e0;
}

.dark-mode #darkModeToggle {
background-color: #333; /* Dark background color */
}

.dark-mode #darkModeIcon {
color: #e0e0e0; /* Dark mode icon color */
}

/* Dark Mode Toggle Button - Hover */
#darkModeToggle:hover {
background-color: #555; /* Dark background color on hover */
}

/* Dark Mode Toggle Button */
#darkModeToggle {
width: 50px;
height: 50px;
border: none; /* Remove border */
position: fixed;
top: 20px;
right: 20px;
z-index: 1000; /* Ensure it's above other content */
}

#darkModeIcon {
font-size: 24px;
}

.dark-mode .custom-box {
background-color: #333 !important; /* Dark mode background color for the login container */
color: #e0e0e0; /* Dark mode text color for the login container */
}

/*------------ Login container ------------*/

.box-area{
Expand Down
55 changes: 55 additions & 0 deletions public/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -328,4 +328,59 @@ body{

#contact {
margin-bottom: 50px; /* Adjust the value as needed */
}

body {
transition: background-color 0.3s, color 0.3s;
}

.dark-mode {
background-color: #121212;
color: #e0e0e0;
}

.navbar.bg-body-secondary {
background-color: var(--bs-body-bg);
}

.dark-mode .navbar.bg-body-secondary {
background-color: #1c1c1c;
}

.dark-mode .hero_text,
.dark-mode .hero_text2,
.dark-mode .hero_text3 {
color: #e0e0e0;
}

/* Dark mode styles */
.dark-mode .navbar {
background-color: #333 !important;
}

.dark-mode .navbar .navbar-brand,
.dark-mode .navbar .nav-link,
.dark-mode .navbar .btn {
color: #e0e0e0;
}

.dark-mode .navbar-toggler {
border-color: #e0e0e0;
}

.dark-mode .navbar-toggler-icon {
filter: invert(1);
}

.dark-mode .contact .text {
color: #e0e0e0;
}

.dark-mode .title {
color: #e0e0e0;
}

.dark-mode .icons .info .head,
.dark-mode .icons .info .sub-title {
color: #e0e0e0;
}
33 changes: 31 additions & 2 deletions views/NGO-Registration.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="css/admin_css.css">
<link rel="shortcut icon" href="img/logo.png" type="image/x-icon">
Expand Down Expand Up @@ -88,12 +89,15 @@
</style>
</head>
<body>

<!-- Dark Mode -->
<button id="darkModeToggle" class="btn btn-dark">
<i id="darkModeIcon" class="fas fa-sun"></i>
</button>
<section class="container">
<header class="header">NGO Registration Form</header>
<br>
<hr>
<form action="/NGO-Registarion" class="form" method="POST">
<form action="/NGO-Registarion" class="form custom-box" method="POST">
<div class="input-box">
<label>NGO Name</label>
<input type="text" name="NgoName" placeholder="Enter NGO name" required />
Expand Down Expand Up @@ -125,6 +129,31 @@
</form>
</section>

<script>
document.addEventListener('DOMContentLoaded', function () {
const darkModeToggle = document.getElementById('darkModeToggle');
const darkModeIcon = document.getElementById('darkModeIcon');
const body = document.body;
const isDarkMode = localStorage.getItem('darkMode') === 'true';
// Function to toggle dark mode
function toggleDarkMode() {
const isDark = body.classList.toggle('dark-mode');
localStorage.setItem('darkMode', isDark);
darkModeIcon.className = isDark ? 'fas fa-moon' : 'fas fa-sun'; // Change icon based on mode
}
// Set initial mode based on localStorage
if (isDarkMode) {
toggleDarkMode();
}
// Event listener for dark mode toggle button
darkModeToggle.addEventListener('click', toggleDarkMode);
});
</script>

<script src="js/index.js"></script>

</body>
Expand Down
30 changes: 29 additions & 1 deletion views/Ngo_login.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,25 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="stylesheet" href="css/admin_css.css">
<link rel="shortcut icon" href="img/logo.png" type="image/x-icon">
<title> NGO Login</title>
</head>
<body>
<!-- Dark Mode -->
<button id="darkModeToggle" class="btn btn-dark">
<i id="darkModeIcon" class="fas fa-sun"></i>
</button>

<!----------------------- Main Container -------------------------->

<div class="container d-flex justify-content-center align-items-center min-vh-100">

<!----------------------- Login Container -------------------------->

<div class="row border rounded-5 p-3 bg-white shadow box-area">
<div class="row border rounded-5 p-3 bg-white shadow box-area custom-box">

<!--------------------------- Left Box ----------------------------->

Expand Down Expand Up @@ -74,6 +79,29 @@

</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function () {
const darkModeToggle = document.getElementById('darkModeToggle');
const darkModeIcon = document.getElementById('darkModeIcon');
const body = document.body;
const isDarkMode = localStorage.getItem('darkMode') === 'true';
// Function to toggle dark mode
function toggleDarkMode() {
const isDark = body.classList.toggle('dark-mode');
localStorage.setItem('darkMode', isDark);
darkModeIcon.className = isDark ? 'fas fa-moon' : 'fas fa-sun'; // Change icon based on mode
}
// Set initial mode based on localStorage
if (isDarkMode) {
toggleDarkMode();
}
// Event listener for dark mode toggle button
darkModeToggle.addEventListener('click', toggleDarkMode);
});
</script>
</body>
</html>
34 changes: 31 additions & 3 deletions views/User_singUp.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>User Signup Form</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="css/admin_css.css">
<link rel="shortcut icon" href="img/logo.png" type="image/x-icon">

<style>
Expand Down Expand Up @@ -88,12 +90,15 @@ body {
</style>
</head>
<body>

<!-- Dark Mode -->
<button id="darkModeToggle" class="btn btn-dark">
<i id="darkModeIcon" class="fas fa-sun"></i>
</button>
<section class="container">
<header class="header">User Signup Form</header>
<br>
<hr>
<form action="/User_singUp" class="form" method="POST">
<form action="/User_singUp" class="form custom-box" method="POST">
<div class="input-box">
<label>Full Name</label>
<input type="text" name="fname" placeholder="Enter full name" required />
Expand Down Expand Up @@ -143,7 +148,30 @@ body {
<br>
</form>
</section>

<script>
document.addEventListener('DOMContentLoaded', function () {
const darkModeToggle = document.getElementById('darkModeToggle');
const darkModeIcon = document.getElementById('darkModeIcon');
const body = document.body;
const isDarkMode = localStorage.getItem('darkMode') === 'true';
// Function to toggle dark mode
function toggleDarkMode() {
const isDark = body.classList.toggle('dark-mode');
localStorage.setItem('darkMode', isDark);
darkModeIcon.className = isDark ? 'fas fa-moon' : 'fas fa-sun'; // Change icon based on mode
}
// Set initial mode based on localStorage
if (isDarkMode) {
toggleDarkMode();
}
// Event listener for dark mode toggle button
darkModeToggle.addEventListener('click', toggleDarkMode);
});
</script>
<script src="js/index.js"></script>
</body>
</html>
31 changes: 30 additions & 1 deletion views/admin_login.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,25 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="stylesheet" href="css/admin_css.css">
<link rel="shortcut icon" href="img/logo.png" type="image/x-icon">
<title> Admin Login</title>
</head>
<body>
<!-- Dark Mode -->
<button id="darkModeToggle" class="btn btn-dark">
<i id="darkModeIcon" class="fas fa-sun"></i>
</button>

<!----------------------- Main Container -------------------------->

<div class="container d-flex justify-content-center align-items-center min-vh-100">

<!----------------------- Login Container -------------------------->

<div class="row border rounded-5 p-3 bg-white shadow box-area">
<div class="row border rounded-5 p-3 bg-white shadow box-area custom-box">

<!--------------------------- Left Box ----------------------------->

Expand Down Expand Up @@ -74,6 +79,30 @@

</div>
</div>
<!-- Custom JavaScript for dark mode -->
<script>
document.addEventListener('DOMContentLoaded', function () {
const darkModeToggle = document.getElementById('darkModeToggle');
const darkModeIcon = document.getElementById('darkModeIcon');
const body = document.body;
const isDarkMode = localStorage.getItem('darkMode') === 'true';
// Function to toggle dark mode
function toggleDarkMode() {
const isDark = body.classList.toggle('dark-mode');
localStorage.setItem('darkMode', isDark);
darkModeIcon.className = isDark ? 'fas fa-moon' : 'fas fa-sun'; // Change icon based on mode
}
// Set initial mode based on localStorage
if (isDarkMode) {
toggleDarkMode();
}
// Event listener for dark mode toggle button
darkModeToggle.addEventListener('click', toggleDarkMode);
});
</script>
</body>
</html>
Loading

0 comments on commit 4b2ad23

Please sign in to comment.