Skip to content
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
Binary file added .DS_Store
Binary file not shown.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# javascript-project-2022

dostępny pod adresem https://kasiasolinska.github.io/javascript-project-2022/

Projekt - wyszukiwarka tekstów piosenek

w toku...

niestety nie udało mi się połączyć z api :(
Binary file added background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<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>Weather forecast</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<header>
<h1>What's the weather like in...</h1>
</header>
<section>
<form>
<input type="text" placeholder="Get Weather" />
</form>

<div class="wrapper">
<div class="details"></div>
</div>
</section>
<script src="main.js"></script>
</body>
</html>
23 changes: 23 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const apiKey = "0bd56a60b494c2b8ef7759890948e62e";
const apiUrl = "http://api.weatherstack.com/";

const form = document.querySelector("form");
const weatherDetails = document.querySelector(".details");

//event listener

form.addEventListener("submit", (e) => {
e.preventDefault();

const location = document.querySelector("input").value;
getWeather(location);
});

async function getWeather(location) {
const response = await fetch(
`${apiUrl}current?access_key=${apiKey}&query=${location}`
);

const data = await response.json();
console.log(data);
}
18 changes: 18 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
min-height: 100vh;
background-image: url("background.jpg");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
display: flex;
align-items: center;
justify-content: center;
color:ghostwhite;
}