Código do Dashboard

Abaixo está o código HTML e CSS utilizado no dashboard, apresentado de forma não interpretada, para referência e estudo.

HTML


<!DOCTYPE html>
<html lang="pt-br">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Dashboard de Controle de Tarefas</title>
    <link rel="stylesheet" href="style.css" />
    <link
      href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap"
      rel="stylesheet"
    />
    <link
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"
      rel="stylesheet"
    />
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
  </head>
  <body>
    <!-- Menu Lateral Fixo -->
    <nav class="menu-lateral">
      <h2>TaskMaster</h2>
      <ul>
        <li><a href="#overview">Visão Geral</a></li>
        <li><a href="#tasks">Tarefas</a></li>
        <li><a href="#progress">Progresso</a></li>
        <li><a href="#charts">Gráficos</a></li>
        <li><a href="#settings">Configurações</a></li>
      </ul>
    </nav>

    <div class="content">
      <!-- Cabeçalho -->
      <header class="header">
        <h1>Dashboard de Controle de Tarefas</h1>
        <p>Organize suas tarefas e maximize sua produtividade.</p>
      </header>

      <!-- Seção de Visão Geral -->
      <section id="overview" class="overview">
        <div class="card overview-card">
          <i class="fas fa-check-circle"></i>
          <h3>Tarefas Concluídas</h3>
          <p>25</p>
        </div>
        <div class="card overview-card">
          <i class="fas fa-tasks"></i>
          <h3>Tarefas Pendentes</h3>
          <p>10</p>
        </div>
        <div class="card overview-card">
          <i class="fas fa-chart-line"></i>
          <h3>Progresso</h3>
          <p>70%</p>
        </div>
      </section>

      <!-- Seção de Tarefas -->
      <section id="tasks" class="tasks">
        <h2>Minhas Tarefas</h2>
        <div class="task-list">
          <div class="task-card">
            <h3>Tarefa 1</h3>
            <p>Descrição da tarefa 1.</p>
            <button class="btn complete-btn">Completar</button>
          </div>
          <div class="task-card">
            <h3>Tarefa 2</h3>
            <p>Descrição da tarefa 2.</p>
            <button class="btn complete-btn">Completar</button>
          </div>
          <div class="task-card">
            <h3>Tarefa 3</h3>
            <p>Descrição da tarefa 3.</p>
            <button class="btn complete-btn">Completar</button>
          </div>
        </div>
      </section>

      <!-- Seção de Gráficos -->
      <section id="charts" class="charts">
        <h2>Gráficos Simples</h2>
        <div class="charts-container">
          <div class="chart">
            <canvas id="tasksChart"></canvas>
          </div>
          <div class="chart">
            <canvas id="categoryChart"></canvas>
          </div>
          <div class="chart">
            <canvas id="trendChart"></canvas>
          </div>
        </div>
      </section>

      <!-- Seção de Configurações -->
      <section id="settings" class="settings">
        <h2>Configurações</h2>
        <p>Ajuste suas preferências de usuário aqui.</p>
        <button class="btn settings-btn">Salvar Alterações</button>
      </section>
    </div>

    <footer>
      <p>© 2024 TaskMaster. Todos os direitos reservados.</p>
    </footer>

    <script>
      // Gráfico de Barras
      const ctx = document.getElementById("tasksChart").getContext("2d");
      const tasksChart = new Chart(ctx, {
        type: "bar",
        data: {
          labels: ["Seg", "Ter", "Qua", "Qui", "Sex"],
          datasets: [
            {
              label: "Tarefas",
              data: [2, 3, 5, 4, 6],
              backgroundColor: "rgba(76, 175, 80, 0.7)",
              borderColor: "rgba(76, 175, 80, 1)",
              borderWidth: 1,
            },
          ],
        },
        options: {
          responsive: true,
          maintainAspectRatio: true,
          plugins: {
            legend: { display: false },
          },
          scales: {
            y: { display: false },
            x: { display: false },
          },
        },
      });

      // Gráfico de Pizza
      const ctxPie = document.getElementById("categoryChart").getContext("2d");
      const categoryChart = new Chart(ctxPie, {
        type: "pie",
        data: {
          labels: ["Trabalho", "Estudo", "Lazer"],
          datasets: [
            {
              data: [10, 5, 3],
              backgroundColor: ["#4caf50", "#ff9800", "#2196f3"],
            },
          ],
        },
        options: {
          responsive: true,
          maintainAspectRatio: true,
          plugins: {
            legend: { position: "bottom" },
          },
        },
      });

      // Gráfico de Linhas
      const ctxLine = document.getElementById("trendChart").getContext("2d");
      const trendChart = new Chart(ctxLine, {
        type: "line",
        data: {
          labels: ["Semana 1", "Semana 2", "Semana 3", "Semana 4"],
          datasets: [
            {
              label: "Tarefas Concluídas",
              data: [15, 20, 25, 30],
              borderColor: "rgba(33, 150, 243, 1)",
              backgroundColor: "rgba(33, 150, 243, 0.2)",
              fill: true,
              tension: 0.4,
            },
          ],
        },
        options: {
          responsive: true,
          maintainAspectRatio: true,
          plugins: {
            legend: { display: true, position: "top" },
          },
          scales: {
            x: { display: true },
            y: { display: true },
          },
        },
      });
    </script>
  </body>
</html>

CSS


/* Fontes e Cores */
:root {
    --color-background: #f0f2f5;
    --color-sidebar: #4caf50;
    --color-box-shadow: rgba(0, 0, 0, 0.1);
    --color-progress-bar: #e0e0e0;
    --color-hover: #388e3c;
    --color-button: #ffc107;
    --color-button-hover: #ffa000;
    --color-title: #333333;
    --color-paragraph: #666666;
    --color-white: #ffffff;
    --color-grey: #333333;
}

/* Reset e Configurações Globais */
body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--color-background);
    color: var(--color-grey);
    display: flex;
}

/* Títulos */
h1,
h2,
h3 {
    color: var(--color-title);
}

/* Links */
a {
    text-decoration: none;
    color: inherit;
}

/* Menu Lateral */
.menu-lateral {
    background-color: var(--color-sidebar);
    position: fixed;
    top: 0;
    left: 0;
    width: 220px;
    height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 2px 0 5px var(--color-box-shadow);
    z-index: 1;
}

.menu-lateral h2 {
    color: var(--color-white);
    margin-bottom: 30px;
}

.menu-lateral ul {
    list-style: none;
    width: 100%;
    padding: 0;
}

.menu-lateral li {
    margin-bottom: 15px;
}

.menu-lateral a {
    color: var(--color-white);
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 8px;
    transition: background 0.3s;
    display: block;
    text-align: center;
}

.menu-lateral a:hover {
    background-color: var(--color-hover);
}

/* Conteúdo Principal */
.content {
    margin-left: 260px;
    padding: 20px;
    width: calc(100% - 260px);
}

/* Cabeçalho */
.header {
    text-align: center;
    margin-bottom: 20px;
}

.header h1 {
    font-size: 36px;
    margin-bottom: 10px;
}

.header p {
    color: var(--color-paragraph);
    font-size: 18px;
}

/* Cards de Visão Geral */
.overview {
    display: flex;
    gap: 20px;
    justify-content: space-around;
    margin-bottom: 40px;
}

.overview-card {
    background-color: var(--color-white);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 10px var(--color-box-shadow);
    text-align: center;
    flex: 1;
    transition: transform 0.3s, box-shadow 0.3s;
}

.overview-card:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.overview-card i {
    font-size: 40px;
    color: var(--color-sidebar);
    margin-bottom: 10px;
    display: block;
}

.overview-card h3 {
    margin-bottom: 10px;
    font-weight: 600;
}

/* Lista de Tarefas */
.tasks {
    margin-bottom: 40px;
}

.task-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.task-card {
    background-color: var(--color-white);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 10px var(--color-box-shadow);
    border-radius: 10px;
}

.complete-btn {
    margin-top: 10px;
    border: none;
    background-color: var(--color-sidebar);
    color: var(--color-white);
    transition: background 0.3s;
    padding: 10px;
    cursor: pointer;
    border-radius: 5px;
}

.complete-btn:hover {
    background-color: var(--color-hover);
}

/* Seção de Gráficos */
.charts-container {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.chart {
    flex: 1;
    max-width: 30%;
    background-color: var(--color-white);
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 4px 10px var(--color-box-shadow);
}

canvas {
    max-width: 100%;
    height: 120px;
}

/* Seção de Configurações */
.settings {
    text-align: center;
}

.settings-btn {
    margin-top: 20px;
    margin-bottom: 60px;
    background-color: var(--color-button);
    border: none;
    padding: 10px 20px;
    color: var(--color-grey);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.settings-btn:hover {
    background-color: var(--color-button-hover);
    color: var(--color-white);
}

/* Rodapé */
footer {
    text-align: center;
    padding: 10px 0;
    background-color: var(--color-grey);
    color: var(--color-white);
    position: fixed;
    width: 100%;
    bottom: 0;
}

/* Responsividade */
@media (max-width: 768px) {
    .overview {
        flex-direction: column;
    }

    .menu-lateral {
        width: 100%;
        height: auto;
        flex-direction: row;
        overflow-x: scroll;
    }

    .content {
        margin-left: 0;
        width: 100%;
    }

    .charts-container {
        flex-direction: column;
    }

    .chart {
        max-width: 100%;
    }

    canvas {
        height: 100px;
    }
}