Skip to content

Commit

Permalink
Merge pull request #1249 from Prathameshzad/Imagine_AI_team_theme
Browse files Browse the repository at this point in the history
Activated Dark theme in community page and also the text
  • Loading branch information
SurajPratap10 authored Oct 15, 2024
2 parents a4990d6 + 762b70f commit f932a25
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 22 deletions.
46 changes: 26 additions & 20 deletions views/includes/navbar.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -202,27 +202,33 @@
function toggleDarkMode() {
const body = document.body;
const navbar = document.querySelector(".navbar");
const aboutSection = document.querySelector(".about");
const darkModeToggle = document.querySelector(".dark-mode-toggle");
const darkModeIcon = document.getElementsByClassName("dark-mode-icon");
var darkModeIconCollection = Array.from(darkModeIcon);
body.classList.toggle("dark-mode");
navbar.classList.toggle("dark-mode");
aboutSection.classList.toggle("dark-mode");
// darkModeToggle.classList.toggle("dark");
darkModeIconCollection.map((darkIcon) => {
if (darkIcon.innerHTML === '<i class="fa-solid fa-moon" aria-hidden="true"></i>') {
darkIcon.innerHTML = '<i class="fa-solid fa-sun"></i>';
} else {
darkIcon.innerHTML = '<i class="fa-solid fa-moon"></i>';
}
});
const body = document.body;
const navbar = document.querySelector(".navbar");
const sections = document.querySelectorAll("main ,section, .about");
const darkModeIcon = document.querySelectorAll(".dark-mode-icon i");
body.classList.toggle("dark-mode");
navbar.classList.toggle("dark-mode");
sections.forEach(section => {
section.classList.toggle("dark-mode");
});
darkModeIcon.forEach(icon => {
icon.classList.toggle("fa-sun");
icon.classList.toggle("fa-moon");
});
// Store dark mode preference in local storage
localStorage.setItem('darkMode', body.classList.contains('dark-mode'));
}
// On page load, apply the theme based on local storage
document.addEventListener("DOMContentLoaded", () => {
const isDarkMode = JSON.parse(localStorage.getItem('darkMode'));
if (isDarkMode) {
toggleDarkMode(); // Apply dark mode if it was enabled
}
});
</script>

</body>
Expand Down
23 changes: 21 additions & 2 deletions views/team.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
justify-content: center;
align-items: center;
/* padding: 35px 0; */
}
.widget-container {
Expand Down Expand Up @@ -126,7 +128,7 @@
transform: none;
}
.box-content-wrapper {
.box-content-wrapper {
display: flex;
width: 100%;
height: 100%;
Expand All @@ -137,6 +139,10 @@
transform: translateZ(90px);
border-radius: 50%;
.dark-mode {
background-color: #121212;
color: #ffffff;
}
}
Expand Down Expand Up @@ -164,6 +170,10 @@
-webkit-text-fill-color: transparent;
}
.dark-mode .heading-contributors {
-webkit-text-fill-color: #fff; /* Make text white in dark mode */
}
.heading-contributors:after {
content: "Meet our awesome contributors 💙";
position: absolute;
Expand Down Expand Up @@ -191,7 +201,7 @@
</head>
<%- include('includes/navbar.ejs') %>
<main>
<section class="Team">
<section class="team">
<div class="team-top" id="slide">
<div class="heading-contributors">Meet our awesome contributors 💙 </div>

Expand Down Expand Up @@ -281,6 +291,7 @@
.catch((error) => {
console.error("Error fetching contributors:", error);
});
</script>

<script>
Expand All @@ -294,4 +305,12 @@
chatbotId="fZnpFqGqi_Ol7GFejzNXo"
domain="www.chatbase.co"
defer>
</script>

<script>
const toggleThemeButton = document.getElementById("theme-toggle"); // Add a theme toggle button in your HTML
toggleThemeButton.addEventListener("click", () => {
document.body.classList.toggle("dark-mode");
});
</script>

0 comments on commit f932a25

Please sign in to comment.