Skip to content
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

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open

Conversation

SetharikaSok
Copy link

No description provided.

angela100743 and others added 23 commits June 8, 2023 14:19
Comment on lines +1 to +7
const state = {
tempCount: 0,
searchBox: null,
lat: 0,
lon: 0,
tempDisplay: null
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work creating state!

Comment on lines +19 to +45
<section id = "temperature">
<h2>Temperature</h2>
<button id="button-up"> &#8593;</button>
<span id = "count">0</span>
<button id = "button-down"> &#8595;</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">
☁️ 🌞 ☁️ ☀️ ☁️ 🌞

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Markup looks great!

Comment on lines +130 to +148
#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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work with styling 👍🏾

Comment on lines +55 to +70
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');

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

Comment on lines +14 to +30
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!');
});
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏾

Comment on lines +41 to +49
.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();
})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smart approach!

Comment on lines +80 to +104
// 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";
}

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 💯

Copy link

@ameerrah9 ameerrah9 left a 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants