Skip to content

Commit

Permalink
New version.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-catto committed Oct 5, 2023
1 parent 4670084 commit 97d0eba
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 32 deletions.
13 changes: 13 additions & 0 deletions JSON/1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"NikolaTesla" : [
{ "Image" : "./img/1.jpg" },
{ "Image" : "./img/2.jpg" },
{ "Image" : "./img/3.jpg" },
{ "Image" : "./img/4.jpg" },
{ "Image" : "./img/5.jpg" },
{ "Image" : "./img/6.jpg" },
{ "Image" : "./img/7.jpg" },
{ "Image" : "./img/8.jpg" },
{ "Image" : "./img/9.jpg" }
]
}
12 changes: 12 additions & 0 deletions JSON/2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"NikolaTesla" : [
{ "Image" : "./img/10.jpg" },
{ "Image" : "./img/11.jpg" },
{ "Image" : "./img/12.jpg" },
{ "Image" : "./img/13.jpg" },
{ "Image" : "./img/14.jpg" },
{ "Image" : "./img/15.jpg" },
{ "Image" : "./img/16.jpg" },
{ "Image" : "./img/17.jpg" }
]
}
21 changes: 0 additions & 21 deletions Nikola-Tesla.json

This file was deleted.

15 changes: 13 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,19 @@
<header>
<h1>Nikola Tesla</h1>
</header>
<main id="main"></main>
<footer></footer>
<main>
<div class="day">
<p>28/09/2023</p>
<div class="content" id="2"></div>
</div>

<div class="day">
<p>26/09/2023</p>
<div class="content" id="1"></div>
</div>

</main>
<footer><p>By <a href="https://github.com/lucas-catto/" target="blank">Lucas Catto</a></p></footer>
</div>

<script src="./script.js"></script>
Expand Down
24 changes: 20 additions & 4 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@

document.addEventListener("DOMContentLoaded", function(){

fetch('Nikola-Tesla.json')
fetch('./JSON/1.json')

.then(response => response.json())
.then(data => {

let tesla = '';

data.NikolaTesla.forEach(nikola => {

tesla += ` <img src="${nikola.Image}"> `;

});
document.getElementById('main').innerHTML = tesla;
document.getElementById('1').innerHTML = tesla;
})
.catch(error = console.error('Error to load the images: ', error));

});

document.addEventListener("DOMContentLoaded", function(){

fetch('./JSON/2.json')

.then(response => response.json())
.then(data => {

let tesla = '';

data.NikolaTesla.forEach(nikola => {
tesla += ` <img src="${nikola.Image}"> `;
});
document.getElementById('2').innerHTML = tesla;
})
.catch(error = console.error('Error to load the images: ', error));
});
54 changes: 49 additions & 5 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100;400;700&display=swap');

:root {
--default: rgb(24, 24, 53);
}

* {
border: 0;
padding: 0;
Expand Down Expand Up @@ -29,7 +33,7 @@ body {
max-width: 1200px;
height: auto;
min-height: 100%;
background-color: rgb(24, 24, 53);
background-color: var(--default);
}

header {
Expand All @@ -41,12 +45,36 @@ header {
}

main {
width: 100%;
height: auto;
min-height: 100vh;
padding: 14px 0;
}

.day {
width: 100%;
height: auto;

display: flex;
justify-content: space-evenly;
flex-direction: column;
align-items: center;
}

.day p {
text-align: center;
width: 92%;
font-size: 16pt;
border-bottom: 2px solid white;
margin: 15px 0;
padding: 0 0 6px 0;
}

.content {
display: flex;
flex-wrap: wrap;
gap: 20px;
padding: 30px 20px;
justify-content: center;
gap: 25px;
padding: 0 15px;
}

img {
Expand All @@ -55,5 +83,21 @@ img {
height: auto;
vertical-align: middle;
border: 1px solid white;
transition: .2s;
}

footer {
width: 100%;
height: auto;
padding: 15px 0;
text-align: center;
border-top: 1px solid white;
}

a { text-decoration: none; }

a:hover {
color: var(--default);
background-color: white;
border-radius: 3px;
padding: 0 2px;
}

0 comments on commit 97d0eba

Please sign in to comment.