Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.
Open
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: 3 additions & 0 deletions frontend/Untitled-1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
git add.
git commit -m "hello"
git push origin master
31 changes: 29 additions & 2 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,34 @@
<title>LeetCode Leaderboard</title>
</head>
<body class="bg-gray-900 text-white p-5">
<!-- <canvas id="myChart" style="width:100%;max-width:600px"></canvas> -->
<div style="display: flex; justify-content: flex-end;">
<button id="theme-toggle" class="bg-gray-700 text-white px-4 py-2 rounded hover:bg-blue-200 focus:outline-none focus:ring-6 focus:ring-blue-200">
Toggle Dark/Light Mode
</button>
</div>

<script>
const themeToggleBtn = document.getElementById('theme-toggle');
const body = document.body;

// Check for saved user preference, if any, on load of the website
if (localStorage.getItem('theme') === 'light') {
body.classList.remove('bg-gray-900', 'text-white');
body.classList.add('bg-white', 'text-black');
}

themeToggleBtn.addEventListener('click', () => {
if (body.classList.contains('bg-gray-900')) {
body.classList.remove('bg-gray-900', 'text-white');
body.classList.add('bg-white', 'text-black');
localStorage.setItem('theme', 'light');
} else {
body.classList.remove('bg-white', 'text-black');
body.classList.add('bg-gray-900', 'text-white');
localStorage.setItem('theme', 'dark');
}
});
</script>
<div class="container mx-auto my-10">
<div class="">
<!-- Leaderboard -->
Expand Down Expand Up @@ -91,4 +118,4 @@ <h1 class="text-4xl font-bold">TBPPP Leaderboard</h1>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js"></script>
<script src="index.js"></script>
</body>
</html>
</html>
4 changes: 4 additions & 0 deletions frontend/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ tr {
tr:hover {
background-color: rgba(255, 255, 255, 0.1);
}
button{
position: absolute;
bottom:50px;
}