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

Cedar - Maria O. #78

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,41 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Weather Report</title>
<link href="styles/index.css" rel="stylesheet" />
</head>
<body>

<main>

Choose a reason for hiding this comment

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

Nice semantic html!

<!-- page header -->
<header id="page-header">
<h1>Weather Report</h1>
</header>

<!-- city section -->
<section id="city-section">
<h1 class="section-heading">City</h1>
</section>

<!-- temperature section -->
<section id="temperature-section">
<h1 class="section-heading">Temperature</h1>
<button id="incTemp">🔼</button>
<button id="decTemp">🔽</button>
<h2 id="temp"></h2>
</section>

<!-- sky section -->
<section id="sky-section">
<h1 class="section-heading">Sky</h1>
</section>

<!-- landscape section -->
<section id="landscape-section">
<h1 class="section-heading">Weather Garden</h1>
<section id="landscape-container">

</section>
</section>
</main>
<script src="src/index.js" type="text/javascript"></script>
</body>
</html>
47 changes: 47 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// // Event handling
// const addCrab = () => {
// const newCrab = document.createElement("span");
// const crabContainer = document.querySelector("#crabContainer");
// newCrab.textContent = "🦀";
// crabContainer.appendChild(newCrab);
// };

// // Registering event handler
// const registerEventHandlers = () => {
// const crabButton = document.querySelector("#addCrabButton");
// crabButton.addEventListener("click", addCrab);
// };

// document.addEventListener("DOMContentLoaded", registerEventHandlers);

// Event handing
const state = {
currentTemp: 75,
};

// temp is a global variable beware
const temp = document.getElementById('temp');
temp.textContent = state.currentTemp;
console.log('index.js is connected');

const incTemp = () => {
// const temp = document.getElementById('temp');
state.currentTemp += 1;
temp.textContent = state.currentTemp;
};

const decTemp = () => {
state.currentTemp -= 1;
temp.textContent = state.currentTemp;
};

// Registering event handler
const registerEventHandlers = () => {
const incTempButton = document.getElementById('incTemp');
incTempButton.addEventListener('click', incTemp);

const decTempButton = document.getElementById('decTemp');
decTempButton.addEventListener('click', decTemp);
};

document.addEventListener('DOMContentLoaded', registerEventHandlers);
16 changes: 16 additions & 0 deletions styles/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
body {
background-color: #324DF7;
font-family: "Gill Sans", sans-serif;
}

header {
color: white;
}

p {
font-weight: bold;
}

section {
background-color:white;
}