From 579bef00a3f41bcd553498e8b8c0971cb3a485bd Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 1 Oct 2021 00:41:06 +0530 Subject: [PATCH 1/2] refractored the css file --- main.css | 238 +++++++++++++++++++++++++++---------------------------- 1 file changed, 118 insertions(+), 120 deletions(-) diff --git a/main.css b/main.css index 836b0ab..60a84cb 100644 --- a/main.css +++ b/main.css @@ -1,121 +1,119 @@ * { - box-sizing: border-box; - } - - body { - - background-image: url("./images/bg.jpg"); - background-repeat: no-repeat; - display: flex; - align-items: center; - justify-content: center; - min-height: 100vh; - margin: 0; - font-family: Verdana, Geneva, Tahoma, sans-serif; - } - - button { - cursor: pointer; - font-size: 14px; - border-radius: 4px; - padding: 5px 15px; - } - - select { - width: 200px; - padding: 5px; - appearance: none; - -webkit-appearance: none; - -moz-appearance: none; - border-radius: 20px; - background-color: #a7c5e3; - - } - - select:focus, - button:focus { - outline: 0; - } - - .settings-btn { - position: absolute; - bottom: 30px; - left: 30px; - } - - .settings { - position: absolute; - top: 0; - left: 0; - width: 100%; - background-color: rgba(0, 0, 0, 0.3); - height: 70px; - color: #fff; - display: flex; - align-items: center; - justify-content: center; - transform: translateY(0); - transition: transform 0.3s ease-in-out; - } - - .settings.hide { - transform: translateY(-100%); - } - - .container { - background-color: #565a5e; - padding: 20px; - border-radius: 20px; - box-shadow: 0 3px 5px rgba(0, 0, 0, 0.3); - color: #fff; - position: relative; - text-align: center; - width: 500px; - } - - h2 { - background-color: rgba(0, 0, 0, 0.3); - padding: 8px; - border-radius: 4px; - margin: 0 0 40px; - } - - h1 { - margin: 0; - } - - input { - border: 0; - border-radius: 4px; - font-size: 14px; - width: 300px; - padding: 12px 20px; - margin-top: 10px; - } - - .score-container { - position: absolute; - top: 60px; - right: 20px; - } - - .time-container { - position: absolute; - top: 60px; - left: 20px; - } - - .end-game-container { - background-color: inherit; - display: none; - align-items: center; - justify-content: center; - flex-direction: column; - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - z-index: 1; - border-radius: 20px; - } \ No newline at end of file + box-sizing: border-box; +} + +body { + background-image: url('./images/bg.jpg'); + background-repeat: no-repeat; + display: flex; + align-items: center; + justify-content: center; + min-height: 100vh; + margin: 0; + font-family: Verdana, Geneva, Tahoma, sans-serif; +} + +button { + cursor: pointer; + font-size: 14px; + border-radius: 4px; + padding: 5px 15px; +} + +select { + width: 200px; + padding: 5px; + appearance: none; + -webkit-appearance: none; + -moz-appearance: none; + border-radius: 20px; + background-color: #a7c5e3; +} + +select:focus, +button:focus { + outline: 0; +} + +.settings-btn { + position: absolute; + bottom: 30px; + left: 30px; +} + +.settings { + position: absolute; + top: 0; + left: 0; + width: 100%; + background-color: rgba(0, 0, 0, 0.3); + height: 70px; + color: #fff; + display: flex; + align-items: center; + justify-content: center; + transform: translateY(0); + transition: transform 0.3s ease-in-out; +} + +.settings.hide { + transform: translateY(-100%); +} + +.container { + background-color: #565a5e; + padding: 20px; + border-radius: 20px; + box-shadow: 0 3px 5px rgba(0, 0, 0, 0.3); + color: #fff; + position: relative; + text-align: center; + width: 500px; +} + +h2 { + background-color: rgba(0, 0, 0, 0.3); + padding: 8px; + border-radius: 4px; + margin: 0 0 40px; +} + +h1 { + margin: 0; +} + +input { + border: 0; + border-radius: 4px; + font-size: 14px; + width: 300px; + padding: 12px 20px; + margin-top: 10px; +} + +.score-container { + position: absolute; + top: 60px; + right: 20px; +} + +.time-container { + position: absolute; + top: 60px; + left: 20px; +} + +.end-game-container { + background-color: inherit; + display: none; + align-items: center; + justify-content: center; + flex-direction: column; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 1; + border-radius: 20px; +} From c5af6040c3a7ef8e965e7512cacb71cbd50dd54e Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 1 Oct 2021 00:45:24 +0530 Subject: [PATCH 2/2] refractored js file --- main.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.js b/main.js index b333c9a..1defb7f 100644 --- a/main.js +++ b/main.js @@ -29,7 +29,7 @@ const words = [ 'feeble', 'admit', 'drag', - 'loving' + 'loving', ]; // Init word @@ -104,7 +104,7 @@ addWordToDOM(); // Event listeners // Typing -text.addEventListener('input', e => { +text.addEventListener('input', (e) => { const insertedText = e.target.value; if (insertedText === randomWord) { @@ -130,7 +130,7 @@ text.addEventListener('input', e => { settingsBtn.addEventListener('click', () => settings.classList.toggle('hide')); // Settings select -settingsForm.addEventListener('change', e => { +settingsForm.addEventListener('change', (e) => { difficulty = e.target.value; localStorage.setItem('difficulty', difficulty); -}); \ No newline at end of file +});