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

Rh dark mode test #22

Closed
wants to merge 14 commits into from
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/pr-bot-welcome.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ github.event.number }},
body: 'Thank you for your contribution! 🙏 We will review your PR as soon as possible.\n The KubeTidy team'
body: 'Thank you for your contribution! 🙏 We will review your PR as soon as possible.\n\n ## The KubeTidy team'
});
29 changes: 22 additions & 7 deletions docs/_includes/nav_footer_custom.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,42 @@
<script>
const btnToggle = document.querySelector('.js-toggle-dark-mode');

// Set theme based on localStorage
if (localStorage.getItem('theme') === 'dark') {
jtd.setTheme('dark');
btnToggle.textContent = '☼ light';
} else {
jtd.setTheme('light');
btnToggle.textContent = '☾ dark';
}
</script>

<script>
const toggleDarkMode = document.querySelector('.js-toggle-dark-mode');

jtd.addEvent(toggleDarkMode, 'click', function () {
// Add event listener to toggle dark mode
jtd.addEvent(btnToggle, 'click', function () {
if (jtd.getTheme() === 'dark') {
jtd.setTheme('light');
toggleDarkMode.textContent = '☾ dark';
btnToggle.textContent = '☾ dark';
localStorage.setItem('theme', 'light');
} else {
jtd.setTheme('dark');
toggleDarkMode.textContent = '☼ light';
btnToggle.textContent = '☼ light';
localStorage.setItem('theme', 'dark');
}
});

// Hide on scroll functionality
let lastScrollTop = 0;

window.addEventListener('scroll', function() {
let scrollTop = window.pageYOffset || document.documentElement.scrollTop;

if (scrollTop > lastScrollTop) {
// User is scrolling down
btnToggle.style.display = 'none';
} else {
// User is scrolling up
btnToggle.style.display = 'block';
}

lastScrollTop = scrollTop <= 0 ? 0 : scrollTop; // For mobile or negative scroll (bounce)
});
</script>
2 changes: 1 addition & 1 deletion docs/_sass/custom/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ button.js-toggle-dark-mode {
outline: 2px solid #007b9a; /* Darker outline when actively clicked */
background-color: rgba(17, 169, 187, 0.3); /* Darker background when clicked */
color: #007b9a; /* Darker text when clicked */
}
}
Loading