mirror of
https://github.com/appen-isen/projet-cal.git
synced 2026-01-18 16:47:38 +01:00
html css
This commit is contained in:
BIN
frontend/assets/bg-winter.png
Normal file
BIN
frontend/assets/bg-winter.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 809 KiB |
@@ -2,9 +2,39 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Calendrier de l'Avent</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
coucou
|
||||
<div class="background">
|
||||
<div class="grid">
|
||||
<div class="box box-5" id="day-5">5</div>
|
||||
<div class="box box-17" id="day-17">17</div>
|
||||
<div class="box box-1" id="day-1">1</div>
|
||||
<div class="box box-24" id="day-24">24</div>
|
||||
<div class="box box-12" id="day-12">12</div>
|
||||
<div class="box box-7" id="day-7">7</div>
|
||||
<div class="box box-19" id="day-19">19</div>
|
||||
<div class="box box-3" id="day-3">3</div>
|
||||
<div class="box box-9" id="day-9">9</div>
|
||||
<div class="box box-22" id="day-22">22</div>
|
||||
<div class="box box-15" id="day-15">15</div>
|
||||
<div class="box box-13" id="day-13">13</div>
|
||||
<div class="box box-8" id="day-8">8</div>
|
||||
<div class="box box-6" id="day-6">6</div>
|
||||
<div class="box box-2" id="day-2">2</div>
|
||||
<div class="box box-20" id="day-20">20</div>
|
||||
<div class="box box-14" id="day-14">14</div>
|
||||
<div class="box box-10" id="day-10">10</div>
|
||||
<div class="box box-23" id="day-23">23</div>
|
||||
<div class="box box-11" id="day-11">11</div>
|
||||
<div class="box box-4" id="day-4">4</div>
|
||||
<div class="box box-18" id="day-18">18</div>
|
||||
<div class="box box-16" id="day-16">16</div>
|
||||
<div class="box box-21" id="day-21">21</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
39
frontend/script.js
Normal file
39
frontend/script.js
Normal file
@@ -0,0 +1,39 @@
|
||||
// URL de l'API
|
||||
const apiUrl = "http://localhost:8080/api/get_day";
|
||||
|
||||
// Fonction pour récupérer les données depuis l'API
|
||||
async function fetchDayData() {
|
||||
try {
|
||||
const response = await fetch(apiUrl);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
const data = await response.json(); // Exemple de réponse : { link: "...", date: "..." }
|
||||
updateCalendar(data);
|
||||
} catch (error) {
|
||||
console.error("Erreur lors de l'appel API :", error);
|
||||
}
|
||||
}
|
||||
|
||||
// Fonction pour mettre à jour le calendrier avec les données récupérées
|
||||
function updateCalendar(data) {
|
||||
|
||||
const dateParts = data.date.split("-"); // Supposons que la date est au format "YYYY-MM-DD"
|
||||
const day = parseInt(dateParts[2], 10); // Récupérer le jour comme entier
|
||||
|
||||
const box = document.getElementById(`day-${day}`);
|
||||
if (box) {
|
||||
// Ajouter un contenu ou une action à la boîte correspondant à la date
|
||||
box.innerHTML = `<a href="${data.link}" target="_blank">🎁</a>`;
|
||||
box.classList.add("opened"); // Classe CSS optionnelle pour indiquer que la case est ouverte
|
||||
} else {
|
||||
console.warn(`Aucune boîte trouvée pour le jour ${day}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Appel de la fonction à l'initialisation de la page
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
fetchDayData();
|
||||
});
|
||||
77
frontend/style.css
Normal file
77
frontend/style.css
Normal file
@@ -0,0 +1,77 @@
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: 'Quicksand', sans-serif;
|
||||
background: linear-gradient(to bottom, #005f73, #0a9396);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.background {
|
||||
background: url('assets/bg-winter.png') no-repeat center center;
|
||||
background-size: cover;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(6, 1fr);
|
||||
grid-auto-rows: 100px;
|
||||
gap: 5px;
|
||||
padding: 10px;
|
||||
max-width: 700px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Style des boîtes */
|
||||
.box {
|
||||
background: linear-gradient(145deg, #e63946, #f4a261);
|
||||
border: 1px solid rgba(255, 255, 255, 0.6);
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.3);
|
||||
border-radius: 10px;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-family: 'Great Vibes', cursive;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
transition: transform 0.2s, box-shadow 0.2s;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* Animation au survol */
|
||||
.box:hover {
|
||||
transform: scale(1.05);
|
||||
box-shadow: 0 6px 10px rgba(0, 0, 0, 0.4), inset 0 2px 6px rgba(255, 255, 255, 0.4);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Dispositions variées */
|
||||
.box-1 { grid-column: 1 / span 1; grid-row: 1 / span 1; }
|
||||
.box-2 { grid-column: 2 / span 1; grid-row: 1 / span 2; }
|
||||
.box-3 { grid-column: 3 / span 2; grid-row: 1 / span 1; }
|
||||
.box-4 { grid-column: 5 / span 2; grid-row: 1 / span 1; }
|
||||
.box-5 { grid-column: 1 / span 1; grid-row: 2 / span 1; }
|
||||
.box-6 { grid-column: 4 / span 1; grid-row: 2 / span 1; }
|
||||
.box-7 { grid-column: 6 / span 1; grid-row: 2 / span 1; }
|
||||
.box-8 { grid-column: 1 / span 2; grid-row: 3 / span 1; }
|
||||
.box-9 { grid-column: 3 / span 1; grid-row: 2 / span 2; }
|
||||
.box-10 { grid-column: 4 / span 1; grid-row: 3 / span 2; }
|
||||
.box-11 { grid-column: 5 / span 1; grid-row: 2 / span 2; }
|
||||
.box-12 { grid-column: 6 / span 1; grid-row: 3 / span 2; }
|
||||
.box-13 { grid-column: 1 / span 1; grid-row: 4 / span 1; }
|
||||
.box-14 { grid-column: 2 / span 2; grid-row: 4 / span 1; }
|
||||
.box-15 { grid-column: 5 / span 1; grid-row: 4 / span 1; }
|
||||
.box-16 { grid-column: 1 / span 2; grid-row: 5 / span 1; }
|
||||
.box-17 { grid-column: 3 / span 1; grid-row: 5 / span 1; }
|
||||
.box-18 { grid-column: 4 / span 1; grid-row: 5 / span 1; }
|
||||
.box-19 { grid-column: 5 / span 2; grid-row: 5 / span 1; }
|
||||
.box-20 { grid-column: 1 / span 1; grid-row: 6 / span 1; }
|
||||
.box-21 { grid-column: 2 / span 1; grid-row: 6 / span 1; }
|
||||
.box-22 { grid-column: 3 / span 2; grid-row: 6 / span 1; }
|
||||
.box-23 { grid-column: 5 / span 1; grid-row: 6 / span 1; }
|
||||
.box-24 { grid-column: 6 / span 1; grid-row: 6 / span 1; }
|
||||
Reference in New Issue
Block a user