Skip to content

Commit b3a2c95

Browse files
committed
Enhance Roman analog clock with improved date display
- Increased date font size from 8px to 12px for better readability - Enhanced date styling with better padding, border, and text shadow - Added letter spacing and improved typography - Enhanced backdrop blur and border effects - Updated mobile responsive styling for consistent appearance - Improved visual hierarchy and contrast for date display
2 parents ffb701c + 8fea2b4 commit b3a2c95

File tree

4 files changed

+561
-3
lines changed

4 files changed

+561
-3
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111

1212
**[View Live Application →](https://eaglepython.github.io/DOM-Project)**
1313

14-
<img width="1524" height="881" alt="BookVault Dashboard" src="https://github.com/user-attachments/assets/42c7867e-8c58-4ef7-ba8a-ad34f0f9cee0" />
14+
<img width="1567" height="880" alt="image" src="https://github.com/user-attachments/assets/99698620-cf41-4559-931a-16601d3ed302" />
15+
1516

1617
## ✨ Key Features
1718

1819
### 🎠 Infinite Horizontal Carousel
1920
- **Smooth Infinite Scroll** with CSS animations showcasing featured books
20-
- **10 Curated Books** with validated, high-quality cover images
21+
- **30 Curated Books** with validated, high-quality cover images
2122
- **Auto-play Toggle** with intuitive pause/play controls
2223
- **Hover Interactions** that pause the carousel for better UX
2324
- **Responsive Design** that works seamlessly on all devices

index.html

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,27 @@ <h1 class="text-xl font-bold text-gray-900 dark:text-white">BookVault</h1>
9191
<i class="fas fa-plus mr-3"></i>
9292
<span>Add Book</span>
9393
</button>
94+
95+
<!-- Mobile Live Clock -->
96+
<div class="live-clock-container mobile-clock-container">
97+
<div class="live-clock mobile-clock">
98+
<div class="clock-item">
99+
<span class="clock-value" id="mobile-hours">--</span>
100+
<span class="clock-label">HOURS</span>
101+
</div>
102+
<div class="clock-separator">:</div>
103+
<div class="clock-item">
104+
<span class="clock-value" id="mobile-minutes">--</span>
105+
<span class="clock-label">MINS</span>
106+
</div>
107+
<div class="clock-separator">:</div>
108+
<div class="clock-item">
109+
<span class="clock-value" id="mobile-seconds">--</span>
110+
<span class="clock-label">SECS</span>
111+
</div>
112+
</div>
113+
<div class="clock-date mobile-date" id="mobile-live-date">--</div>
114+
</div>
94115
</div>
95116
</div>
96117
</div>
@@ -158,6 +179,58 @@ <h2 class="text-3xl md:text-5xl font-bold mb-4 leading-tight">
158179
</div>
159180
</div>
160181
</div>
182+
183+
<!-- Roman Analog Clock -->
184+
<div class="absolute top-4 left-4 roman-clock-container">
185+
<div class="roman-clock">
186+
<div class="clock-face">
187+
<!-- Hour markers and Roman numerals -->
188+
<div class="hour-marker" style="transform: rotate(0deg)">
189+
<span class="roman-numeral">XII</span>
190+
</div>
191+
<div class="hour-marker" style="transform: rotate(30deg)">
192+
<span class="roman-numeral">I</span>
193+
</div>
194+
<div class="hour-marker" style="transform: rotate(60deg)">
195+
<span class="roman-numeral">II</span>
196+
</div>
197+
<div class="hour-marker" style="transform: rotate(90deg)">
198+
<span class="roman-numeral">III</span>
199+
</div>
200+
<div class="hour-marker" style="transform: rotate(120deg)">
201+
<span class="roman-numeral">IV</span>
202+
</div>
203+
<div class="hour-marker" style="transform: rotate(150deg)">
204+
<span class="roman-numeral">V</span>
205+
</div>
206+
<div class="hour-marker" style="transform: rotate(180deg)">
207+
<span class="roman-numeral">VI</span>
208+
</div>
209+
<div class="hour-marker" style="transform: rotate(210deg)">
210+
<span class="roman-numeral">VII</span>
211+
</div>
212+
<div class="hour-marker" style="transform: rotate(240deg)">
213+
<span class="roman-numeral">VIII</span>
214+
</div>
215+
<div class="hour-marker" style="transform: rotate(270deg)">
216+
<span class="roman-numeral">IX</span>
217+
</div>
218+
<div class="hour-marker" style="transform: rotate(300deg)">
219+
<span class="roman-numeral">X</span>
220+
</div>
221+
<div class="hour-marker" style="transform: rotate(330deg)">
222+
<span class="roman-numeral">XI</span>
223+
</div>
224+
225+
<!-- Clock hands -->
226+
<div class="clock-hand hour-hand" id="hour-hand"></div>
227+
<div class="clock-hand minute-hand" id="minute-hand"></div>
228+
<div class="clock-hand second-hand" id="second-hand"></div>
229+
<div class="clock-center"></div>
230+
</div>
231+
<div class="clock-date" id="roman-clock-date">Loading...</div>
232+
</div>
233+
</div>
161234
</div>
162235
</div>
163236
</section>

index.js

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ class BookStore {
2525
];
2626
this.currentTypewriterIndex = 0;
2727

28+
// Mobile clock tracking
29+
this.previousMobileHours = '';
30+
this.previousMobileMinutes = '';
31+
this.previousMobileSeconds = '';
32+
this.previousMobileDate = '';
33+
2834
this.init();
2935
}
3036

@@ -34,6 +40,7 @@ class BookStore {
3440
this.initializeTheme();
3541
this.updateReadingListUI();
3642
this.startTypewriterEffect();
43+
this.startRomanClock();
3744
await this.loadBooks();
3845
this.setupViewMode();
3946
this.initializeCarousel();
@@ -1785,6 +1792,122 @@ class BookStore {
17851792
typewrite();
17861793
}
17871794

1795+
// Roman Analog Clock Display
1796+
startRomanClock() {
1797+
const updateClock = () => {
1798+
const now = new Date();
1799+
1800+
// Get time components
1801+
const hours = now.getHours() % 12;
1802+
const minutes = now.getMinutes();
1803+
const seconds = now.getSeconds();
1804+
1805+
// Calculate angles for hands (360 degrees = full circle)
1806+
const hourAngle = (hours * 30) + (minutes * 0.5); // 30 degrees per hour + minute adjustment
1807+
const minuteAngle = minutes * 6; // 6 degrees per minute
1808+
const secondAngle = seconds * 6; // 6 degrees per second
1809+
1810+
// Update hand positions smoothly
1811+
const hourHand = document.getElementById('hour-hand');
1812+
const minuteHand = document.getElementById('minute-hand');
1813+
const secondHand = document.getElementById('second-hand');
1814+
1815+
if (hourHand) {
1816+
hourHand.style.transform = `rotate(${hourAngle}deg)`;
1817+
}
1818+
if (minuteHand) {
1819+
minuteHand.style.transform = `rotate(${minuteAngle}deg)`;
1820+
}
1821+
if (secondHand) {
1822+
secondHand.style.transform = `rotate(${secondAngle}deg)`;
1823+
}
1824+
1825+
// Update date display
1826+
const options = {
1827+
weekday: 'short',
1828+
month: 'short',
1829+
day: 'numeric'
1830+
};
1831+
const currentDate = now.toLocaleDateString('en-US', options);
1832+
const dateElement = document.getElementById('roman-clock-date');
1833+
if (dateElement) {
1834+
dateElement.textContent = currentDate;
1835+
}
1836+
1837+
// Update mobile clock if it exists
1838+
this.updateMobileClockWithAnimation(
1839+
String(now.getHours()).padStart(2, '0'),
1840+
String(minutes).padStart(2, '0'),
1841+
String(seconds).padStart(2, '0'),
1842+
currentDate
1843+
);
1844+
};
1845+
1846+
// Initial update
1847+
updateClock();
1848+
1849+
// Update every second
1850+
setInterval(updateClock, 1000);
1851+
}
1852+
1853+
updateTimeWithAnimation(elementId, newValue, previousValue) {
1854+
const element = document.getElementById(elementId);
1855+
if (!element) return;
1856+
1857+
if (newValue !== previousValue) {
1858+
// Add rolling animation class
1859+
element.classList.add('rolling-digit', 'flip');
1860+
1861+
// Update the value
1862+
element.textContent = newValue;
1863+
1864+
// Remove animation class after animation completes
1865+
setTimeout(() => {
1866+
element.classList.remove('flip');
1867+
}, 600);
1868+
}
1869+
}
1870+
1871+
updateMobileClockWithAnimation(hours, minutes, seconds, date) {
1872+
// Update mobile clock elements with animation
1873+
this.updateClockElement('mobile-hours', hours, this.previousMobileHours);
1874+
this.updateClockElement('mobile-minutes', minutes, this.previousMobileMinutes);
1875+
this.updateClockElement('mobile-seconds', seconds, this.previousMobileSeconds);
1876+
1877+
// Update mobile date
1878+
const mobileDateElement = document.getElementById('mobile-live-date');
1879+
if (mobileDateElement && date !== this.previousMobileDate) {
1880+
mobileDateElement.textContent = date;
1881+
}
1882+
1883+
// Store previous values
1884+
this.previousMobileHours = hours;
1885+
this.previousMobileMinutes = minutes;
1886+
this.previousMobileSeconds = seconds;
1887+
this.previousMobileDate = date;
1888+
}
1889+
1890+
updateClockElement(elementId, newValue, previousValue) {
1891+
const element = document.getElementById(elementId);
1892+
if (!element) return;
1893+
1894+
if (newValue !== previousValue) {
1895+
// Add rolling animation class
1896+
element.classList.add('flip');
1897+
1898+
// Update the value
1899+
element.textContent = newValue;
1900+
1901+
// Remove animation class after animation completes
1902+
setTimeout(() => {
1903+
element.classList.remove('flip');
1904+
}, 600);
1905+
} else if (!element.textContent || element.textContent === '--') {
1906+
// Initial load
1907+
element.textContent = newValue;
1908+
}
1909+
}
1910+
17881911
// Infinite Horizontal Carousel functionality
17891912
initializeCarousel() {
17901913
if (this.books.length > 0) {

0 commit comments

Comments
 (0)