-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Amethyst-Angela-Setharika #70
base: main
Are you sure you want to change the base?
Conversation
…nge on counter number.
…to change cloudIcond in the weather garden
…rch bar and search output.
const state = { | ||
tempCount: 0, | ||
searchBox: null, | ||
lat: 0, | ||
lon: 0, | ||
tempDisplay: null | ||
}; |
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.
Amazing work creating state!
<section id = "temperature"> | ||
<h2>Temperature</h2> | ||
<button id="button-up"> ↑</button> | ||
<span id = "count">0</span> | ||
<button id = "button-down"> ↓</button> | ||
<button id = "realtime">Get Realtime Temperature</button> | ||
</section> | ||
<section id = "sky"> | ||
<h2>Sky</h2> | ||
<select id = "moods" name = "moods"> | ||
<option value = "sunny">Sunny</option> | ||
<option value = "cloudy">Cloudy</option> | ||
<option value = "rainy">Rainy</option> | ||
<option value = "snowy">snowy</option> | ||
</select> | ||
</section> | ||
<section id = "city"> | ||
<h2>City Name</h2> | ||
<input id = "search" type="text" onchange="citySearchFunction(this)" placeholder="type a city" /> | ||
<button id = "reset"> | ||
Reset | ||
</button> | ||
</section> | ||
<section id = "garden"> | ||
<h2>Weather Garden</h2> | ||
<content id="clouds"> | ||
☁️ 🌞 ☁️ ☀️ ☁️ 🌞 |
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.
Markup looks great!
#city { | ||
grid-column: 2; | ||
grid-row: 2/3; | ||
background-color:#f1ffc4; | ||
background-image: url('https://images.unsplash.com/photo-1558486012-817176f84c6d?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=740&q=80'); | ||
background-repeat: no-repeat; | ||
background-attachment: fixed; | ||
background-size: 100% 100%; | ||
color: #FFFFFF; | ||
text-align: center; | ||
object-fit: cover; | ||
|
||
} | ||
|
||
#search { | ||
border: 5px; | ||
border-color:black solid; | ||
border-radius: 5px; | ||
margin: 45px; |
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.
Amazing work with styling 👍🏾
font-size: 150%; | ||
} | ||
|
||
header, footer, #temperature, #sky, #city { | ||
padding: 1em; | ||
} | ||
|
||
/* ========================== End of Main Field Boxes ========================== */ | ||
|
||
/* ========================== Start: Inside of Temperature Field ========================== */ | ||
#temperature { | ||
grid-column: 1 / 3; | ||
grid-row: 1; | ||
/* background-color:#89CFF0; */ | ||
position: relative; | ||
background-image: url('https://images.unsplash.com/photo-1558486012-817176f84c6d?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=740&q=80'); |
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.
Nice work with this organization
const findLatitudeAndLongitude = async (input) => { | ||
await axios.get('http://127.0.0.1:5000/location', | ||
{ | ||
params: { | ||
q: input, | ||
format: 'json' | ||
} | ||
}) | ||
.then( (response) => { | ||
state.lat = response.data[0].lat; | ||
state.lon = response.data[0].lon; | ||
console.log('success in findLatitudeAndLongitude!', state.lat, state.lon); | ||
}) | ||
.catch( (error) => { | ||
console.log('error in findLatitudeAndLongitude!'); | ||
}); | ||
} |
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.
👍🏾
.then( (response) => { | ||
console.log('success in findWeather!', response.data); | ||
state.tempCount = response.data.main.temp; | ||
state.tempDisplay.innerText = state.tempCount; | ||
const fahrenheitTemp = kelvinToFahrenheit(state.tempCount); | ||
state.tempCount = Math.floor(fahrenheitTemp); | ||
state.tempDisplay.innerText = Math.floor(fahrenheitTemp); | ||
updateColor(); | ||
}) |
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.
Smart approach!
// function for city search | ||
const citySearchFunction = (input) => { | ||
const output = document.getElementById('search-output'); | ||
output.value = camelSentence(input.value); | ||
}; | ||
|
||
function camelSentence(str) { | ||
return (" " + str).toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, function(match, chr) | ||
{ | ||
return chr.toUpperCase(); | ||
}); | ||
} | ||
|
||
// function for Realtime Temperature | ||
async function resetRealtime() { | ||
await findLatitudeAndLongitude(state.searchBox.value) | ||
await findWeather(state.lat, state.lon) | ||
kelvinToFahrenheit(state.tempCount) | ||
} | ||
|
||
// function for Reset City with a defual location | ||
function resetCity () { | ||
document.querySelector("#search-output").innerHTML ="Atlanta"; | ||
document.querySelector("#search").value = "Atlanta"; | ||
} |
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.
Great function naming, this looks really clean 💯
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.
Great work, Angela + Rika! 🥳
Thank you for your patience as we catch up on grading. Nice work! The HTML is structured well and the JS is clear and well-factored. This project is a Green. 🟢
Keep it up!
No description provided.