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
17 changes: 17 additions & 0 deletions Studio Ghibli/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title>Ghibli App</title>

<link href="https://fonts.googleapis.com/css?family=Dosis:400,700" rel="stylesheet" />
<link href="style.css" rel="stylesheet" />
</head>

<body>
<div id="root"></div>
<script src="scripts.js"></script>
</body>
</html>
40 changes: 40 additions & 0 deletions Studio Ghibli/scripts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const app = document.getElementById('root')

const logo = document.createElement('img')
logo.src = 'https://p.kindpng.com/picc/s/57-578400_official-studio-ghibli-logo-hd-png-download.png'

const container = document.createElement('div')
container.setAttribute('class', 'container')

app.appendChild(logo)
app.appendChild(container)

var request = new XMLHttpRequest()
request.open('GET', 'https://ghibliapi.herokuapp.com/films', true)
request.onload = function () {
// Begin accessing JSON data here
var data = JSON.parse(this.response)
if (request.status >= 200 && request.status < 400) {
data.forEach((movie) => {
const card = document.createElement('div')
card.setAttribute('class', 'card')

const h1 = document.createElement('h1')
h1.textContent = movie.title

const p = document.createElement('p')
movie.description = movie.description.substring(0, 300)
p.textContent = `${movie.description}...`

container.appendChild(card)
card.appendChild(h1)
card.appendChild(p)
})
} else {
const errorMessage = document.createElement('marquee')
errorMessage.textContent = `Gah, it's not working!`
app.appendChild(errorMessage)
}
}

request.send()
44 changes: 44 additions & 0 deletions Studio Ghibli/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
body{
background-image: url(https://data.whicdn.com/images/291635471/original.gif);
background-size: 100%;

}
#root {
max-width: 1200px;
margin: 0 auto;
}

.container {
display: flex;
flex-wrap: wrap;
}

.card {
margin: 1rem;
border: 1px solid gray;
border-radius: 30px;
margin-bottom: 20px;
background: white;
}

@media screen and (min-width: 600px) {
.card {
flex: 1 1 calc(50% - 2rem);
}
}

@media screen and (min-width: 900px) {
.card {
flex: 1 1 calc(33% - 2rem);
}
}
h1{
border: 1px solid pink;
border-top: 50px;
border-radius: 30px;
background-color: pink;
font-size: 30px;
}
p{
margin: 0 20px;
}