-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from faizalmsdev/adding-projects
Implement Pomodoro Timer Project
- Loading branch information
Showing
5 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" href="style.css"> | ||
<title>Pomodoro Timer</title> | ||
</head> | ||
<body> | ||
|
||
<div class="container"> | ||
<h1 class="title"> | ||
Pomodoro Timer | ||
</h1> | ||
<p class="timer" id="timer"> | ||
25:00 | ||
</p> | ||
<div class="button-wrapper"> | ||
<button id="start">Start</button> | ||
<button id="stop">Stop</button> | ||
<button id="reset">Reset</button> | ||
</div> | ||
</div> | ||
|
||
|
||
|
||
<script src="script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const start = document.getElementById('start'); | ||
const stop = document.getElementById('stop'); | ||
const reset = document.getElementById('reset'); | ||
const timer = document.getElementById('timer'); | ||
|
||
|
||
let interval; | ||
|
||
let timeLeft = 1500; | ||
|
||
function update(){ | ||
let minutes = Math.floor(timeLeft / 60); | ||
let seconds = timeLeft % 60 ; | ||
let formattedTime =` ${minutes} : ${seconds}`; | ||
|
||
timer.innerHTML = formattedTime; | ||
} | ||
|
||
function startTimer(){ | ||
interval = setInterval(() => { | ||
timeLeft--; | ||
update(); | ||
if(timeLeft === 0){ | ||
alert('Times Up'); | ||
timeLeft = 1500; | ||
} | ||
}, 1000); | ||
} | ||
|
||
|
||
function stopTimer(){ | ||
clearInterval(interval); | ||
} | ||
function resetTimer(){ | ||
clearInterval(interval); | ||
timeLeft = 1500; | ||
update(); | ||
} | ||
|
||
start.addEventListener('click', startTimer); | ||
stop.addEventListener('click', stopTimer); | ||
reset.addEventListener('click', resetTimer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
.container{ | ||
margin: 0 auto; | ||
max-width: 400px; | ||
text-align: center; | ||
padding: 20px; | ||
font-family: "Roboto",sans-serif; | ||
background-color: #f5f5f5; | ||
margin-top:120px; | ||
} | ||
|
||
.title{ | ||
font-size: 36px; | ||
margin-bottom: 10px; | ||
color: #2c3e50; | ||
} | ||
|
||
.timer{ | ||
font-size: 72px; | ||
color: #2c3e50; | ||
} | ||
|
||
button{ | ||
font-size: 18px; | ||
padding:10px 20px; | ||
margin: 10px; | ||
color: #fff; | ||
border: none; | ||
border-radius: 4px; | ||
cursor: pointer; | ||
text-transform: uppercase; | ||
transition: opacity .3s ease-in-out; | ||
} | ||
|
||
button:hover{ | ||
opacity: 70%; | ||
} | ||
|
||
#start{ | ||
background-color: #37ae60; | ||
} | ||
|
||
#stop{ | ||
background-color: #c0392b; | ||
} | ||
|
||
#reset{ | ||
background-color: #7f8c8d; | ||
} | ||
|
||
|
||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56a3d40
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
web-projects – ./
web-projects-alsiam.vercel.app
alprojects.vercel.app
web-projects-git-main-alsiam.vercel.app
al-projects.vercel.app