diff --git a/30 - Temperature Converter/index.html b/30 - Temperature Converter/index.html new file mode 100644 index 000000000..30cb34bc4 --- /dev/null +++ b/30 - Temperature Converter/index.html @@ -0,0 +1,28 @@ + + + + + + + Temperature Converter | WebDev Journey + + + + +
+

Temperature Converter

+
+ + +
+ +

+
+ + + + + \ No newline at end of file diff --git a/30 - Temperature Converter/script.js b/30 - Temperature Converter/script.js new file mode 100644 index 000000000..a20e0599c --- /dev/null +++ b/30 - Temperature Converter/script.js @@ -0,0 +1,20 @@ +function Convert() { + + let degreeInput = document.getElementById('degreeInput').value; + let scaleInput = document.getElementById('ScaleInput').value; + + if (degreeInput === '') { + return + } + + degreeInput = parseFloat(degreeInput); + + if (scaleInput.toLowerCase() === 'fehrenheit') { + let fehrenheit = (degreeInput * (9 / 5) + 32); + document.querySelector('.showTemperature').textContent = `${fehrenheit.toFixed(1)}\u00B0F`; + } else { + let celsuis = (degreeInput - 32) * (5 / 9); + document.querySelector('.showTemperature').textContent = `${celsuis.toFixed(1)}\u00B0C`; + } + document.getElementById('degreeInput').value = ''; +} diff --git a/30 - Temperature Converter/style.css b/30 - Temperature Converter/style.css new file mode 100644 index 000000000..5a7efcf9d --- /dev/null +++ b/30 - Temperature Converter/style.css @@ -0,0 +1,73 @@ +@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Special+Gothic+Expanded+One&display=swap'); + +*{ + margin: 0; + padding: 0; + box-sizing: border-box; + font-family: 'Poppins'; +} +body{ + min-height: 100svh; + display: grid; + place-items: center; + background: #143D60; +} +.container{ + display: flex; + flex-direction: column; + background: #F1F0E9; + padding: 20px; + width: 370px; + border-radius: 5px; +} +.container h1{ + font-size: 22px; + margin-bottom: 20px; +} +.container .inputFields{ + margin-bottom: 15px; + display: flex; + justify-content: space-between; +} +.container input{ + border: 1px solid #ccc; + background: none; + outline: none; + font-size: 15px; + padding: 3px 10px; +} +.container select { + padding: 3px 30px 3px 10px; + font-size: 15px; + appearance: none; + background: url('data:image/svg+xml;utf8,') no-repeat right 6px center; + border: 1px solid #ccc; + cursor: pointer; +} +.container button{ + padding: 5px; + font-size: 15.5px; + border: none; + outline: none; + background: #255F38; + color: white; + font-weight: 450; + cursor: pointer; + margin-bottom: 20px; +} +.container h2{ + font-size: 23px; + font-family: 'Cascadia mono'; +} +@media (max-width:750px){ + .container{ + width: 350px; + } + .container input{ + width: 185px; + } + .container select{ + width: 120px; + padding: 3px 25px 3px 10px; + } +} \ No newline at end of file