Skip to content

Commit 964fae9

Browse files
committed
Final Date time added.
Time: 5:00 AM Date: 7-04-2025 Signed-off-by: Someshdiwan <[email protected]>
1 parent 6ca2313 commit 964fae9

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

site/_layouts/default.html

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,19 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>Dynamic Sidebar Page</title>
7-
<link rel="stylesheet" href="/assets/style.css" />
6+
<title>{{ page.title }}</title>
7+
<link rel="stylesheet" href="{{ "/assets/style.css" | relative_url }}" />
88
<script>
9-
// Sidebar Toggle Function
109
function toggleSidebar() {
1110
const sidebar = document.getElementById("sidebar");
1211
sidebar.classList.toggle("hidden");
1312
}
1413

15-
// Dark Mode Toggle Function
1614
const toggleDarkMode = () => {
1715
document.body.classList.toggle("dark-mode");
1816
localStorage.setItem("dark-mode", document.body.classList.contains("dark-mode"));
1917
};
2018

21-
// Handle Sidebar Visibility Based on Screen Size
2219
function handleSidebarVisibility() {
2320
const sidebar = document.getElementById("sidebar");
2421
if (window.matchMedia("(max-width: 768px)").matches) {
@@ -28,14 +25,13 @@
2825
}
2926
}
3027

31-
// Update Time Display
3228
function updateTime() {
3329
const now = new Date();
3430
let hours = now.getHours();
3531
const minutes = now.getMinutes().toString().padStart(2, "0");
3632
const seconds = now.getSeconds().toString().padStart(2, "0");
3733
const ampm = hours >= 12 ? "PM" : "AM";
38-
hours = hours % 12 || 12; // Convert to 12-hour format
34+
hours = hours % 12 || 12;
3935
const timeString = `${hours}:${minutes}:${seconds} ${ampm}`;
4036

4137
const offset = now.getTimezoneOffset();
@@ -48,7 +44,6 @@
4844
document.getElementById("time-display").textContent = fullTimeString;
4945
}
5046

51-
// Initialize on Load
5247
window.onload = () => {
5348
handleSidebarVisibility();
5449
if (localStorage.getItem("dark-mode") === "true") {
@@ -61,27 +56,24 @@
6156
if (!sidebar.classList.contains("hidden")) {
6257
sidebar.classList.add("hidden");
6358
}
64-
}, 10000); // 10 seconds
59+
}, 10000);
6560
};
6661

67-
// Update on Resize
6862
window.addEventListener("resize", handleSidebarVisibility);
6963
</script>
7064
</head>
7165
<body>
7266
<div class="wrapper">
7367
<div id="sidebar" class="sidebar">
74-
<a href="#">Home</a>
75-
<a href="#">About</a>
76-
<a href="#">Services</a>
77-
<a href="#">Contact</a>
68+
{% include nav.html %}
7869
</div>
7970
<div class="content">
8071
<div id="time-display"></div>
8172
<button class="toggle-btn" onclick="toggleSidebar()"></button>
82-
<button class="toggle-btn" id="dark-mode-toggle" onclick="toggleDarkMode()">Toggle Dark Mode</button>
83-
<h1>Welcome</h1>
84-
<p>This is a sample page with a dynamic sidebar and time display.</p>
73+
<button class="toggle-btn" id="dark-mode-toggle" onclick="toggleDarkMode()">🌓</button>
74+
<div class="fade-in">
75+
{{ content }}
76+
</div>
8577
</div>
8678
</div>
8779
</body>

0 commit comments

Comments
 (0)