diff --git a/.vscode/settings.json b/.vscode/settings.json index d83b5ba6c..939e4aa87 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,5 +3,8 @@ "editor.defaultFormatter": "esbenp.prettier-vscode", "workbench.editorAssociations": { "*.md": "vscode.markdown.preview.editor" - } + }, + "githubPullRequests.ignoredPullRequestBranches": [ + "main" + ] } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index d6b5fd56a..a87d148a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,9 @@ "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.6", "vite": "^5.2.0" + }, + "engines": { + "node": ">=20.0.0" } }, "node_modules/@eslint-community/eslint-utils": { diff --git a/src/img/pomodoro.png b/src/img/pomodoro.png new file mode 100644 index 000000000..21932d51f Binary files /dev/null and b/src/img/pomodoro.png differ diff --git a/src/img/vector-cartoon-style-illustration-kitchen-260nw-2257872349.png b/src/img/vector-cartoon-style-illustration-kitchen-260nw-2257872349.png new file mode 100644 index 000000000..7ee68dcb7 Binary files /dev/null and b/src/img/vector-cartoon-style-illustration-kitchen-260nw-2257872349.png differ diff --git a/src/js/App.css b/src/js/App.css new file mode 100644 index 000000000..eac69362b --- /dev/null +++ b/src/js/App.css @@ -0,0 +1,68 @@ +.container { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 100vh; + font-family: Arial, sans-serif; + background-image: url("../img/vector-cartoon-style-illustration-kitchen-260nw-2257872349.png"); + background-size: cover; + background-repeat: no-repeat; +} + + +.controls { + display: flex; + flex-direction: column; + align-items: center; +} + + +.pomodoro { + width: 200px; + height: 200px; + border-radius: 50%; + position: relative; + overflow: hidden; + display: flex; + align-items: center; + justify-content: center; + margin-bottom: 20px; + background-image: url("../img/pomodoro.png"); + background-size: cover; +} + + +.time-display { + position: absolute; + color: white; + font-size: 36px; + font-weight: bold; +} + + +.buttons { + margin-top: 20px; + text-align: center; +} + + +button { + background-color: greenyellow; + border: none; + border-radius: 5px; + margin: 10px; + padding: 10px 20px; + cursor: pointer; +} + + +button:disabled { + background-color: #f0f0f0; + cursor: not-allowed; +} + + +button:hover:not(:disabled) { + background-color: #ffd700; +} diff --git a/src/js/App.jsx b/src/js/App.jsx new file mode 100644 index 000000000..773fad7d5 --- /dev/null +++ b/src/js/App.jsx @@ -0,0 +1,73 @@ +import React, { useState, useEffect } from 'react'; +import './App.css'; + + +const App = () => { + const [timeLeft, setTimeLeft] = useState(0); + const [running, setRunning] = useState(false); + + + useEffect(() => { + let timer; + if (running && timeLeft > 0) { + timer = setInterval(() => { + setTimeLeft(prev => prev - 1); + }, 1000); + } else if (timeLeft === 0 && running) { + alert('¡Tiempo de cocción ha terminado!'); + setRunning(false); + } + return () => clearInterval(timer); + }, [running, timeLeft]); + + + const handleStart = (minutes) => { + const totalSeconds = minutes * 60; + setTimeLeft(totalSeconds); + setRunning(true); + }; + + + const handleExtraMinute = () => { + setTimeLeft(prev => prev + 60); + }; + + + const handleToggle = () => { + setRunning(prev => !prev); + }; + + + const handleReset = () => { + setTimeLeft(0); + setRunning(false); + }; + + + return ( +
-
-
- Made by{" "} - 4Geeks Academy, with - love! -
-