Atualização do calendario
This commit is contained in:
118
calendario.css
118
calendario.css
@@ -59,12 +59,57 @@ body {
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#calendarseta {
|
||||||
|
display: flex;
|
||||||
|
gap: 15px; /* espaço entre as setas */
|
||||||
|
}
|
||||||
|
|
||||||
#calendarseta button {
|
#calendarseta button {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
border: none;
|
border: none;
|
||||||
color: white;
|
color: white;
|
||||||
font-size: 18px;
|
font-size: 26px; /* tamanho maior */
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
padding: 5px 10px; /* aumenta área de clique */
|
||||||
|
transition: transform 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
#calendarseta button:hover {
|
||||||
|
transform: scale(1.2); /* efeito ao passar o mouse */
|
||||||
|
}
|
||||||
|
.setas-grande {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.titulo-mes {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dia-semana {
|
||||||
|
background: #f0f0f0;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 12px;
|
||||||
|
padding: 10px 0;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
.antGrande,
|
||||||
|
.proxGrande {
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
color: #1f3b57;
|
||||||
|
font-size: 26px;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 5px 10px;
|
||||||
|
transition: transform 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.antGrande:hover,
|
||||||
|
.proxGrande:hover {
|
||||||
|
transform: scale(1.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.calendariodia {
|
.calendariodia {
|
||||||
@@ -275,14 +320,21 @@ body {
|
|||||||
|
|
||||||
/* ===== CALENDÁRIO GRANDE ===== */
|
/* ===== CALENDÁRIO GRANDE ===== */
|
||||||
.calendar-area {
|
.calendar-area {
|
||||||
flex: 1;
|
|
||||||
margin: 20px;
|
|
||||||
background: #ddd;
|
|
||||||
border-radius: 8px;
|
|
||||||
|
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(7, 1fr);
|
grid-template-columns: repeat(7, 1fr);
|
||||||
grid-auto-rows: 120px;
|
|
||||||
|
/* PRIMEIRA LINHA MENOR */
|
||||||
|
grid-template-rows: 40px repeat(6, 120px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DIAS DA SEMANA */
|
||||||
|
.dia-semana {
|
||||||
|
background: #f0f0f0;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 13px;
|
||||||
|
padding: 10px 0;
|
||||||
|
border: 1px solid #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dia-box {
|
.dia-box {
|
||||||
@@ -304,3 +356,55 @@ body {
|
|||||||
.icone-img:hover {
|
.icone-img:hover {
|
||||||
transform: scale(1.15);
|
transform: scale(1.15);
|
||||||
}
|
}
|
||||||
|
.calendar-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
padding: 10px 20px;
|
||||||
|
background: #eee;
|
||||||
|
border-bottom: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ESQUERDA (MÊS + SETAS) */
|
||||||
|
.mes-nav {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.titulo-mes {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #1f3b57;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seta {
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
font-size: 22px;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #c0392b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DIREITA (DIA / SEMANA / MÊS) */
|
||||||
|
.view-switch {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.view-switch button {
|
||||||
|
border: none;
|
||||||
|
padding: 6px 14px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: transparent;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #1f3b57;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* BOTÃO ATIVO (MÊS) */
|
||||||
|
.view-switch .active {
|
||||||
|
background: #c0392b;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
217
calendario.html
217
calendario.html
@@ -81,10 +81,22 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- MÊS -->
|
<!-- MÊS -->
|
||||||
<div class="month-title">
|
<div class="calendar-header">
|
||||||
<span>‹</span>
|
|
||||||
Janeiro, 2025
|
<!-- ESQUERDA (SETAS + MÊS) -->
|
||||||
<span>›</span>
|
<div class="mes-nav">
|
||||||
|
<button class="seta antGrande">‹</button>
|
||||||
|
<span class="titulo-mes">Janeiro, 2025</span>
|
||||||
|
<button class="seta proxGrande">›</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- DIREITA (DIA / SEMANA / MÊS) -->
|
||||||
|
<div class="view-switch">
|
||||||
|
<button>Dia</button>
|
||||||
|
<button>Semana</button>
|
||||||
|
<button class="active">Mês</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- CALENDÁRIO GRANDE -->
|
<!-- CALENDÁRIO GRANDE -->
|
||||||
@@ -92,24 +104,25 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- SCRIPT -->
|
|
||||||
<script>
|
<script>
|
||||||
/* ===== MINI CALENDÁRIO ===== */
|
/* ===== VARIÁVEIS ===== */
|
||||||
|
let dataMini = new Date();
|
||||||
let dataAtual = new Date();
|
let dataGrande = new Date();
|
||||||
|
|
||||||
function renderCalendario() {
|
|
||||||
const mesEl = document.getElementById("mes");
|
|
||||||
const diasEl = document.getElementById("dias");
|
|
||||||
|
|
||||||
|
/* ===== MESES ===== */
|
||||||
const meses = [
|
const meses = [
|
||||||
"Janeiro", "Fevereiro", "Março", "Abril",
|
"Janeiro", "Fevereiro", "Março", "Abril",
|
||||||
"Maio", "Junho", "Julho", "Agosto",
|
"Maio", "Junho", "Julho", "Agosto",
|
||||||
"Setembro", "Outubro", "Novembro", "Dezembro"
|
"Setembro", "Outubro", "Novembro", "Dezembro"
|
||||||
];
|
];
|
||||||
|
|
||||||
let ano = dataAtual.getFullYear();
|
/* ===== MINI CALENDÁRIO ===== */
|
||||||
let mes = dataAtual.getMonth();
|
function renderCalendario() {
|
||||||
|
const mesEl = document.getElementById("mes");
|
||||||
|
const diasEl = document.getElementById("dias");
|
||||||
|
|
||||||
|
let ano = dataMini.getFullYear();
|
||||||
|
let mes = dataMini.getMonth();
|
||||||
|
|
||||||
mesEl.textContent = `${meses[mes]} ${ano}`;
|
mesEl.textContent = `${meses[mes]} ${ano}`;
|
||||||
|
|
||||||
@@ -119,7 +132,7 @@
|
|||||||
|
|
||||||
diasEl.innerHTML = "";
|
diasEl.innerHTML = "";
|
||||||
|
|
||||||
let diaAtual = 1;
|
let diaAtualNum = 1;
|
||||||
let diaSeguinte = 1;
|
let diaSeguinte = 1;
|
||||||
|
|
||||||
let totalCelulas = primeiroDia + ultimoDia;
|
let totalCelulas = primeiroDia + ultimoDia;
|
||||||
@@ -136,18 +149,18 @@
|
|||||||
let dia = ultimoDiaMesAnterior - (primeiroDia - pos - 1);
|
let dia = ultimoDiaMesAnterior - (primeiroDia - pos - 1);
|
||||||
linha.innerHTML += `<td class="outromes">${dia}</td>`;
|
linha.innerHTML += `<td class="outromes">${dia}</td>`;
|
||||||
}
|
}
|
||||||
else if (diaAtual <= ultimoDia) {
|
else if (diaAtualNum <= ultimoDia) {
|
||||||
let hoje = new Date();
|
let hoje = new Date();
|
||||||
|
|
||||||
let classeHoje =
|
let classeHoje =
|
||||||
diaAtual === hoje.getDate() &&
|
diaAtualNum === hoje.getDate() &&
|
||||||
mes === hoje.getMonth() &&
|
mes === hoje.getMonth() &&
|
||||||
ano === hoje.getFullYear()
|
ano === hoje.getFullYear()
|
||||||
? "today"
|
? "today"
|
||||||
: "";
|
: "";
|
||||||
|
|
||||||
linha.innerHTML += `<td class="${classeHoje}">${diaAtual}</td>`;
|
linha.innerHTML += `<td class="${classeHoje}">${diaAtualNum}</td>`;
|
||||||
diaAtual++;
|
diaAtualNum++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
linha.innerHTML += `<td class="outromes">${diaSeguinte}</td>`;
|
linha.innerHTML += `<td class="outromes">${diaSeguinte}</td>`;
|
||||||
@@ -159,62 +172,121 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.querySelector(".prox").onclick = () => {
|
/* ===== CALENDÁRIO GRANDE ===== */
|
||||||
dataAtual.setMonth(dataAtual.getMonth() + 1);
|
function renderCalendarioGrande() {
|
||||||
|
const area = document.getElementById("calendarArea");
|
||||||
|
const titulo = document.querySelector(".titulo-mes");
|
||||||
|
|
||||||
|
let ano = dataGrande.getFullYear();
|
||||||
|
let mes = dataGrande.getMonth();
|
||||||
|
|
||||||
|
/* ATUALIZA TÍTULO */
|
||||||
|
titulo.textContent = `${meses[mes]}, ${ano}`;
|
||||||
|
|
||||||
|
area.innerHTML = "";
|
||||||
|
|
||||||
|
/* DIAS DA SEMANA */
|
||||||
|
const diasSemana = ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"];
|
||||||
|
|
||||||
|
diasSemana.forEach(dia => {
|
||||||
|
area.innerHTML += `<div class="dia-semana">${dia}</div>`;
|
||||||
|
});
|
||||||
|
|
||||||
|
let primeiroDia = new Date(ano, mes, 1).getDay();
|
||||||
|
let ultimoDia = new Date(ano, mes + 1, 0).getDate();
|
||||||
|
let ultimoMesAnterior = new Date(ano, mes, 0).getDate();
|
||||||
|
|
||||||
|
let total = primeiroDia + ultimoDia;
|
||||||
|
let linhas = Math.ceil(total / 7);
|
||||||
|
|
||||||
|
let diaAtualNum = 1;
|
||||||
|
let proxMes = 1;
|
||||||
|
|
||||||
|
for (let i = 0; i < linhas * 7; i++) {
|
||||||
|
let classe = "dia-box";
|
||||||
|
let numero = "";
|
||||||
|
|
||||||
|
if (i < primeiroDia) {
|
||||||
|
numero = ultimoMesAnterior - (primeiroDia - i - 1);
|
||||||
|
classe += " outro-mes";
|
||||||
|
}
|
||||||
|
else if (diaAtualNum <= ultimoDia) {
|
||||||
|
numero = diaAtualNum;
|
||||||
|
|
||||||
|
let hoje = new Date();
|
||||||
|
if (
|
||||||
|
diaAtualNum === hoje.getDate() &&
|
||||||
|
mes === hoje.getMonth() &&
|
||||||
|
ano === hoje.getFullYear()
|
||||||
|
) {
|
||||||
|
classe += " today";
|
||||||
|
}
|
||||||
|
|
||||||
|
diaAtualNum++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
numero = proxMes++;
|
||||||
|
classe += " outro-mes";
|
||||||
|
}
|
||||||
|
|
||||||
|
area.innerHTML += `<div class="${classe}">${numero}</div>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== ATUALIZAÇÕES ===== */
|
||||||
|
function atualizarMini() {
|
||||||
renderCalendario();
|
renderCalendario();
|
||||||
|
}
|
||||||
|
|
||||||
|
function atualizarGrande() {
|
||||||
|
renderCalendarioGrande();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== SETAS MINI ===== */
|
||||||
|
document.querySelector(".prox").onclick = () => {
|
||||||
|
dataMini.setMonth(dataMini.getMonth() + 1);
|
||||||
|
atualizarMini();
|
||||||
};
|
};
|
||||||
|
|
||||||
document.querySelector(".ant").onclick = () => {
|
document.querySelector(".ant").onclick = () => {
|
||||||
dataAtual.setMonth(dataAtual.getMonth() - 1);
|
dataMini.setMonth(dataMini.getMonth() - 1);
|
||||||
renderCalendario();
|
atualizarMini();
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ===== CALENDÁRIO GRANDE ===== */
|
/* ===== SETAS GRANDE ===== */
|
||||||
|
document.querySelector(".antGrande").onclick = () => {
|
||||||
|
dataGrande.setMonth(dataGrande.getMonth() - 1);
|
||||||
|
atualizarGrande();
|
||||||
|
};
|
||||||
|
|
||||||
function renderCalendarioGrande() {
|
document.querySelector(".proxGrande").onclick = () => {
|
||||||
const area = document.getElementById("calendarArea");
|
dataGrande.setMonth(dataGrande.getMonth() + 1);
|
||||||
area.innerHTML = "";
|
atualizarGrande();
|
||||||
|
};
|
||||||
|
|
||||||
for (let i = 0; i < 35; i++) {
|
/* ===== BOTÕES DIA / SEMANA / MÊS ===== */
|
||||||
area.innerHTML += `<div class="dia-box"></div>`;
|
const botoesView = document.querySelectorAll(".view-switch button");
|
||||||
|
|
||||||
|
botoesView.forEach(btn => {
|
||||||
|
btn.addEventListener("click", () => {
|
||||||
|
botoesView.forEach(b => b.classList.remove("active"));
|
||||||
|
btn.classList.add("active");
|
||||||
|
|
||||||
|
const tipo = btn.textContent;
|
||||||
|
|
||||||
|
if (tipo === "Dia") {
|
||||||
|
alert("Modo DIA (você pode implementar depois)");
|
||||||
}
|
}
|
||||||
|
else if (tipo === "Semana") {
|
||||||
|
alert("Modo SEMANA (você pode implementar depois)");
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
/* ===== DADOS ===== */
|
atualizarGrande(); // Mês já funciona
|
||||||
|
|
||||||
let agendaData = [
|
|
||||||
{
|
|
||||||
hora: "08:15 – 09:15",
|
|
||||||
titulo: "Coçar oq fazer",
|
|
||||||
link: "https://youtube.com",
|
|
||||||
cor: "azul"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
hora: "09:00 – 10:00",
|
|
||||||
titulo: "COMO QUE DIMINUI A FONTE?",
|
|
||||||
link: "https://sccor.com",
|
|
||||||
cor: "azul"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
hora: "11:00 – 11:45",
|
|
||||||
titulo: "Pintar boobie-goods",
|
|
||||||
cor: "rosa"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
hora: "18:20 – 23:00",
|
|
||||||
titulo: "Ir pro curso (infelizmente)",
|
|
||||||
link: "dom 4, BBP",
|
|
||||||
cor: "azul"
|
|
||||||
}
|
}
|
||||||
];
|
});
|
||||||
|
});
|
||||||
let feriadosData = [
|
|
||||||
{ texto: "15 – Proclamação da República" },
|
|
||||||
{ texto: "20 – Dia Nacional da Consciência Negra" }
|
|
||||||
];
|
|
||||||
|
|
||||||
/* ===== RENDER AGENDA ===== */
|
|
||||||
|
|
||||||
|
/* ===== AGENDA ===== */
|
||||||
function renderAgenda() {
|
function renderAgenda() {
|
||||||
const container = document.getElementById("agenda");
|
const container = document.getElementById("agenda");
|
||||||
|
|
||||||
@@ -235,8 +307,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===== RENDER FERIADOS ===== */
|
/* ===== FERIADOS ===== */
|
||||||
|
|
||||||
function renderFeriados() {
|
function renderFeriados() {
|
||||||
const container = document.getElementById("feriados");
|
const container = document.getElementById("feriados");
|
||||||
|
|
||||||
@@ -254,14 +325,22 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===== INICIAR ===== */
|
/* ===== DADOS ===== */
|
||||||
|
let agendaData = [
|
||||||
|
{ hora: "08:15 – 09:15", titulo: "Evento 1", cor: "azul" },
|
||||||
|
{ hora: "10:00 – 11:00", titulo: "Evento 2", cor: "rosa" }
|
||||||
|
];
|
||||||
|
|
||||||
renderCalendario();
|
let feriadosData = [
|
||||||
renderCalendarioGrande();
|
{ texto: "01 – Ano Novo" }
|
||||||
|
];
|
||||||
|
|
||||||
|
/* ===== INICIAR ===== */
|
||||||
|
atualizarMini();
|
||||||
|
atualizarGrande();
|
||||||
renderAgenda();
|
renderAgenda();
|
||||||
renderFeriados();
|
renderFeriados();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user