Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
KaBreaK authored Jul 26, 2024
1 parent a604ec6 commit 9227d7c
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 0 deletions.
Binary file added img1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgopen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Moja Strona</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="container"></div>
<script src="script.js"></script>
</body>
</html>
27 changes: 27 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
document.addEventListener('DOMContentLoaded', () => {
const container = document.getElementById('container');

// Funkcja do pobierania danych z pliku JSON
async function fetchTexts() {
try {
const response = await fetch('text.json'); // Załaduj dane z pliku JSON
const texts = await response.json();
createSquares(texts);
} catch (error) {
console.error('Błąd podczas pobierania danych:', error);
}
}

// Funkcja do tworzenia kwadratów z tekstem
function createSquares(textArray) {
textArray.forEach(text => {
const square = document.createElement('div');
square.classList.add('square');
square.textContent = text;
container.appendChild(square);
});
}

// Wywołanie funkcji pobierającej dane z JSON
fetchTexts();
});
34 changes: 34 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f4f4f4;
}

#container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(512px, 1fr));
gap: 10px;
width: 90%;
margin-top: 100%;
}
.square {
display: flex;
background-image: url(img1.png);
background-size: cover;
background-position: center center;
border: 2px solid #ddd;
border-radius: 5px;
padding: 20px;
height: 350px;
flex-direction: column;
align-items: center;
justify-content: end;
}

.square:hover {
background-color: #f0f0f0;
}
22 changes: 22 additions & 0 deletions text.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[
"Lorem ipsum dolor sit amet",
"Consectetur adipiscing elit",
"Sed do eiusmod tempor incididunt",
"Ut labore et dolore magna aliqua",
"Ut enim ad minim veniam",
"Quis nostrud exercitation ullamco",
"Laboris nisi ut aliquip ex ea commodo",
"Duis aute irure dolor in reprehenderit",
"In voluptate velit esse cillum",
"Dolore eu fugiat nulla pariatur",
"Excepteur sint occaecat cupidatat non",
"Proident, sunt in culpa qui officia",
"Delectus aut odit aut fugit",
"Nulla pariatur exercitation ullamco laboris nisi",
"Ut aliquip ex ea commodo consequat",
"Duis aute irure dolor in reprehenderit",
"Voluptate velit esse cillum dolore eu fugiat nulla pariatur",
"Excepteur sint occaecat cupidatat non proident",
"Sunt in culpa qui officia deserunt mollit anim id est laborum"

]

0 comments on commit 9227d7c

Please sign in to comment.