Skip to content

Commit 648c543

Browse files
committed
added full screen
1 parent 866523f commit 648c543

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

index.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,25 @@ body {
297297
font-style: italic;
298298
}
299299

300+
.fullscreen-button {
301+
position: fixed;
302+
top: 1rem;
303+
right: 1rem;
304+
background: transparent;
305+
color: rgba(128, 128, 128, 0.6);
306+
border: none;
307+
border-radius: 6px;
308+
padding: 0.75rem;
309+
cursor: pointer;
310+
font-size: 1.2rem;
311+
z-index: 100;
312+
transition: all 0.3s ease;
313+
}
314+
315+
.fullscreen-button:hover {
316+
color: rgba(128, 128, 128, 1);
317+
}
318+
300319
/* Focus styles for accessibility */
301320
button:focus,
302321
input:focus {

src/pomodoro-timer.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class PomodoroTimer extends DataroomElement {
1616

1717
// Render immediately
1818
this.renderStartScreen();
19+
this.addFullscreenButton();
1920
}
2021

2122
async loadPlaylists() {
@@ -385,6 +386,23 @@ class PomodoroTimer extends DataroomElement {
385386
const remainingSeconds = seconds % 60;
386387
return `${minutes.toString().padStart(2, '0')}:${remainingSeconds.toString().padStart(2, '0')}`;
387388
}
389+
390+
addFullscreenButton() {
391+
const button = document.createElement('button');
392+
button.className = 'fullscreen-button';
393+
button.innerHTML = '⛶';
394+
button.title = 'Toggle Fullscreen';
395+
button.addEventListener('click', () => this.toggleFullscreen());
396+
document.body.appendChild(button);
397+
}
398+
399+
toggleFullscreen() {
400+
if (!document.fullscreenElement) {
401+
document.documentElement.requestFullscreen();
402+
} else {
403+
document.exitFullscreen();
404+
}
405+
}
388406
}
389407

390408
if (!customElements.get('pomodoro-timer')) {

0 commit comments

Comments
 (0)