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

Sharks - Philomena Kelly #75

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

Conversation

Philomena-Kelly
Copy link

No description provided.

Copy link

@spitsfire spitsfire left a comment

Choose a reason for hiding this comment

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

Good job,Philomena! Your JS is very well-organized! One thing to consider is how can we dry up a few of the functions that are a long list of if statements and re-assigning state variables?

Something we could do is fatten up state with all of these values, like the image urls in updateLandscape that correlate to the sky or the temperature. For example:

const state = {
  stats: [
    { upperBound: 49, color: "teal", ground: "🌲🌲⛄️🌲⛄️🍂🌲🍁🌲🌲⛄️🍂🌲"},
    { upperBound: 60, color: "yellow", ground: "🌾🌾_🍃_🪨__🛤_🌾🌾🌾_🍃"}
  ]
}

Now we can iterate through our hard coded values that correlate to the right temp or sky by referencing a key just once. That's really all I saw that could be dried up! Nicely done!

updateCity();
};

updateTempAndColor();

Choose a reason for hiding this comment

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

Hmm should this be floating here outside a function? I think the only thing you should initialize or execute immediately when the script file loads is state. Everything else should be triggered by an event

Comment on lines +1 to +19
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>

<input id="city" placeholder="location"><img src="https://cultofthepartyparrot.com/parrots/hd/parrot.gif" id="cityButton" height="25px">
<br>
<img src="https://pngimg.com/uploads/sun/sun_PNG13420.png" alt="sun" height="25px" id="warmer">
<p id="weather">75</p>
<img src="https://pngimg.com/uploads/snowflakes/snowflakes_PNG7593.png" alt="snowflake" height="25px" id="colder">

<script src="/src/index.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</body>
</html>

Choose a reason for hiding this comment

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

secret huh? 🤔

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.

2 participants