Skip to content

Commit

Permalink
Merge pull request #74 from OpenTekHub/revert-57-gh-pages
Browse files Browse the repository at this point in the history
Revert "updated theme toggle with all new themes"
  • Loading branch information
Harish-2003 authored Oct 4, 2024
2 parents b960742 + d672298 commit 97b2e1b
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 100 deletions.
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

Binary file removed Assets/moon.png
Binary file not shown.
Binary file removed Assets/sun.png
Binary file not shown.
7 changes: 2 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@

<body>
<header class="header">
<nav>
<h1>OpenTekHub Blockchain Repository</h1>
<div class="theme-switch" id="theme-switch"></div>
</nav>
<h1>OpenTekHub Blockchain Repository</h1>
</header>

<div class="central">
<p class="tagline">Explore the Blockchain implementation and predict the latest cryptocurrency prices.</p>

<section id="crypto-price-predictor">
<h2>Crypto Price Predictor</h2>
<div id="crypto-form">
Expand Down
40 changes: 0 additions & 40 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,3 @@
// Dark Mode Toggle Functionality
const themeSwitch = document.getElementById('theme-switch'); // Ensure this matches your HTML button's ID
const body = document.body;
const header = document.querySelector('header');
const footer = document.querySelector('footer');

// Function to enable dark mode
function enableDarkMode() {
body.classList.add('dark-mode');
header.classList.add('dark-mode');
themeSwitch.classList.add('dark-theme'); // Update the switch appearance
footer.classList.add('dark-mode');
}

// Function to disable dark mode
function disableDarkMode() {
body.classList.remove('dark-mode');
header.classList.remove('dark-mode');
themeSwitch.classList.remove('dark-theme'); // Update the switch appearance
footer.classList.remove('dark-mode');
}

// Event listener for dark mode toggle button
themeSwitch.addEventListener('click', () => {
if (body.classList.contains('dark-mode')) {
disableDarkMode(); // Switch to light mode
localStorage.removeItem('dark-mode'); // Remove from local storage
} else {
enableDarkMode(); // Switch to dark mode
localStorage.setItem('dark-mode', 'enabled'); // Save in local storage
}
});

// Optional: Check the initial mode on page load and apply the correct theme based on local storage
if (localStorage.getItem('dark-mode') === 'enabled') {
enableDarkMode();
} else {
disableDarkMode(); // Default to light mode on load if localStorage is empty
}
// A map of symbols to their corresponding API names
const cryptoMap = {
// Major cryptocurrencies
Expand Down Expand Up @@ -197,4 +158,3 @@ document.getElementById('predict-btn').addEventListener('click', function() {
document.getElementById("price").innerText = "Please enter a valid cryptocurrency symbol.";
}
});

53 changes: 1 addition & 52 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ h1, h2, h3 {

.header {
text-align: center;
background: linear-gradient(135deg, rgb(36, 11, 54), rgb(195, 20, 50));
background-color: #2E073F;
color: #EBD3F8;
padding: 1.2rem;
font-family: "Mate SC", serif;
Expand Down Expand Up @@ -251,55 +251,4 @@ h1, h2, h3 {
.bot-text{
font-size: 1rem;
margin-block: 0px;
}


/* Here are the styles for the theme toggel */
/* Theme switcher */
.theme-switch {
display: inline-block;
width: 60px;
height: 30px;
border-radius: 30px;
background: linear-gradient(116deg, #ffffff, #a00101);
position: relative;
cursor: pointer;
transition: background 0.3s ease-in-out;
vertical-align: middle;
}

.theme-switch::before {
content: '';
position: absolute;
top: 3px;
left: 3px; /* Initial position for light mode */
width: 24px;
height: 24px;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
transition: left 0.3s ease-in-out, background-image 0.3s ease-in-out;
background-image: url('Assets/moon.png'); /* Icon for light mode */
}

.theme-switch.dark-theme {
background: linear-gradient(92deg, #ff0000, #ffffff); /* Background for dark mode */
}

.theme-switch.dark-theme::before {
left: 33px; /* Move the toggle to the right for dark mode */
background-image: url('Assets/sun.png'); /* Icon for dark mode */
}

/* Other dark mode styles */
.header.dark-mode {
background: linear-gradient(303deg, #000000, #500210);
}

body.dark-mode{
background: linear-gradient(303deg, #000000, #500210);
color: #ffecec;
}
p.tagline.dark-mode{
color: #ffffff;
}

0 comments on commit 97b2e1b

Please sign in to comment.