Skip to content

Commit 8be1f78

Browse files
authored
Merge pull request #858 from AckermanLevi1/MovieInfo-AckermanLevi1
Movie Information Website
2 parents c7d8cd1 + 26e1374 commit 8be1f78

File tree

3 files changed

+123
-0
lines changed

3 files changed

+123
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
body {
2+
font-family: Arial, sans-serif;
3+
}
4+
5+
header {
6+
text-align: center;
7+
background-color: #333;
8+
color: #fff;
9+
padding: 1rem;
10+
}
11+
12+
main {
13+
max-width: 800px;
14+
margin: 0 auto;
15+
padding: 1rem;
16+
}
17+
18+
.search-bar {
19+
text-align: center;
20+
margin-bottom: 1rem;
21+
}
22+
23+
#search-input {
24+
width: 60%;
25+
padding: 0.5rem;
26+
border: 1px solid #ccc;
27+
}
28+
29+
#search-button {
30+
padding: 0.5rem 1rem;
31+
background-color: #333;
32+
color: #fff;
33+
border: none;
34+
cursor: pointer;
35+
}
36+
37+
.movie-info {
38+
display: flex;
39+
align-items: center;
40+
}
41+
42+
.poster img {
43+
max-width: 200px;
44+
}
45+
46+
.details {
47+
margin-left: 1rem;
48+
}
49+
50+
#movie-title {
51+
font-size: 1.5rem;
52+
margin: 0;
53+
}
54+
55+
p {
56+
margin: 0.5rem 0;
57+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<link rel="stylesheet" href="./index.css">
7+
<title>Movie Info Website</title>
8+
</head>
9+
<body>
10+
<header>
11+
<h1>Movie Info Website</h1>
12+
</header>
13+
<main>
14+
<div class="search-bar">
15+
<input type="text" id="search-input" placeholder="Search for a movie">
16+
<button id="search-button">Search</button>
17+
</div>
18+
<div class="movie-info">
19+
<div class="poster">
20+
<img id="movie-poster" src="" alt="Movie Poster">
21+
</div>
22+
<div class="details">
23+
<h2 id="movie-title"></h2>
24+
<p>Genre: <span id="movie-genre"></span></p>
25+
<p>Cast: <span id="movie-cast"></span></p>
26+
<p>IMDb Rating: <span id="movie-rating"></span></p>
27+
<p>Released Date: <span id="movie-released"></span></p>
28+
<p>Director: <span id="movie-director"></span></p>
29+
</div>
30+
</div>
31+
</main>
32+
<script src="./index.js"></script>
33+
</body>
34+
</html>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
const searchButton = document.getElementById('search-button');
2+
const searchInput = document.getElementById('search-input');
3+
const movieTitle = document.getElementById('movie-title');
4+
const movieGenre = document.getElementById('movie-genre');
5+
const movieCast = document.getElementById('movie-cast');
6+
const movieRating = document.getElementById('movie-rating');
7+
const movieReleased = document.getElementById('movie-released');
8+
const movieDirector = document.getElementById('movie-director');
9+
const moviePoster = document.getElementById('movie-poster');
10+
11+
searchButton.addEventListener('click', () => {
12+
// Fetch movie data from an API or your database and update the DOM elements accordingly.
13+
// For example, you can use the OMDB API for this purpose.
14+
const apiKey = 'adff2bf8';
15+
const query = searchInput.value;
16+
17+
// Make an API request to get movie data
18+
fetch(`https://www.omdbapi.com/?t=${query}&apikey=${apiKey}`)
19+
.then(response => response.json())
20+
.then(data => {
21+
movieTitle.textContent = data.Title;
22+
movieGenre.textContent = data.Genre;
23+
movieCast.textContent = data.Actors;
24+
movieRating.textContent = data.imdbRating;
25+
movieReleased.textContent = data.Released;
26+
movieDirector.textContent = data.Director;
27+
moviePoster.src = data.Poster;
28+
})
29+
.catch(error => {
30+
console.error('Error fetching data: ', error);
31+
});
32+
});

0 commit comments

Comments
 (0)