<main>
  
  <section class="section">
    
    <div class="container">

      <div class="bento-grid">
        <div class="bento-item item-1">
          <h5 class="title-medium">BMI</h5>
          <p class="sub-text label-small">Last updated 20 min ago</p>
          <div class="canvas-wrapper">
            <canvas id="chart"></canvas>
          </div>
        </div>
        <div class="bento-item item-2">
          <h5 class="title-medium">My Progress</h5>
          <div style="display: flex; flex-direction: column; width: 100%;">
            <div class="stat-box">
              <div class="stat-items">
                <h6 class="label-small stat-title">Activity</h6>
                <h5 class="body-large">+2,000</h5>  
              </div>
              <div class="stat-icon"><i class="bi bi-activity"></i></div>
            </div>
            <div class="stat-box">
              <div class="stat-items">
                <h6 class="label-small stat-title">Streak</h6>
                <h5 class="body-large">22 Days</h5>  
              </div>
              <div class="stat-icon"><i class="bi bi-fire"></i></div>
            </div>
            <div class="stat-box">
               <div class="stat-items">
                <h6 class="label-small stat-title">Daily Goals</h6>
                <h5 class="body-large">3</h5>  
              </div>
              <div class="stat-icon"><i class="bi bi-flag-fill"></i></div>
            </div>
            <div class="stat-box">
              <div class="stat-items">
                <h6 class="label-small stat-title">Movement</h6>
                <h5 class="body-large">+40%</h5>  
              </div>
              <div class="stat-icon"><i class="bi bi-person-arms-up"></i></div>
            </div>
          </div>
        </div>
        <div class="bento-item item-3">
          <div style="width: 100%;">
            <h5 class="title-medium">Achievements</h5>
            <div class="stat-box">
              <div class="trophy">
                <p class="label-small subtitle">Yesterday</p>
                <div class="trophy-item">
                  <div class="trophy-badge">
                    <i class="bi bi-trophy-fill" style="color: #fff;"></i>
                  </div>
                  <div>
                    <h5 class="body-medium">New Record</h5>
                    Movement - 1.7hrs
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="bento-item item-4">
          <h5 class="title-medium" style="margin-left: 2.75rem; margin-bottom: 1rem;">Daily Stats</h5>
          <div class="table-wrapper">
            <table>
            <thead>
              <tr>
                <th>Day</th>
                <th>BMI</th>
                <th>Goals</th>
                <th>Movement</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>1</td>
                <td>28.3</td>
                <td class="good">Complete<i class="bi bi-check"></i></td>
                <td>1 hr</td>
              </tr>
              <tr>
                <td>2</td>
                <td>28</td>
                <td class="good">Complete<i class="bi bi-check"></i></td>
                <td>1 hr</td>
              </tr>
              <tr>
                <td>3</td>
                <td>27</td>
                <td class="good">Complete<i class="bi bi-check"></i></td>
                <td>1.2 hr</td>
              </tr>
              <tr>
                <td>4</td>
                <td>27.6</td>
                <td class="danger">Missed<i class="bi bi-x"></i></td>
                <td>1 hr</td>
              </tr>
              <tr>
                <td>5</td>
                <td>25</td>
                <td class="good">Complete<i class="bi bi-check"></i></td>
                <td>1.7 hr</td>
              </tr>
              <tr>
                <td>6</td>
                <td>25.6</td>
                <td class="good">Complete<i class="bi bi-check"></i></td>
                <td>1.5 hr</td>
              </tr>
            </tbody>
          </table>
          </div>
        </div>
        
        <div class="bento-item item-min">
          <h5 class="title-medium">KPI 1</h5>
        </div>
        <div class="bento-item item-min">
          <h5 class="title-medium">KPI 2</h5>
          </div>
        <div class="bento-item item-min">
          <h5 class="title-medium">KPI 3</h5>
        </div>
        
        <div class="bento-item item-1">
          <h5 class="title-medium">Movement</h5>
          <p class="sub-text label-small">Last updated 20 min ago</p>
          <div class="canvas-wrapper">
            <canvas id="chart2"></canvas>
          </div>
        </div>
        <div class="bento-item item-2">
          <h5 class="title-medium">Summary</h5>
          <div class="stat-box">
            <p class="body-medium">You exercised for an average of <span id="avg" class="highlight"></span> in the past 6 days.</p>
          </div>
        </div>
        
      </div>
    
      
      
    </div>
  
 </section>
  
</main>
@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.2/font/bootstrap-icons.min.css");
:root {
  --text-color: #000;
  --sub-text: rgb(144 158 186);
  --subtitle: rgb(103, 116, 142);
  
  --orange: rgb(238 146 12);
  
  --font-primary: Geist, sans-serif;

  --page-max-width: 1130px;
  
  --bx-sh-1: rgba(218, 226, 237, 0.6) 0px 4px 8px;
  
  
}

body {
  background: var(--bk-gradient);
  width: 100%;
  height: 100%;
  min-height: 100vh;
  color: var(--text-color);
}

p {
  font-weight: 100;
}

p span {
  display: inline-block;
}

.good {
  color: mediumseagreen;
}

.danger {
  color: crimson;
}

.highlight {
  color: var(--orange);
}

.sub-text {
  color: var(--sub-text);
  font-family: var(--font-secondary);
  font-weight: 500;
}

.subtitle {
  color: var(--subtitle);
}

.bento-grid {
  --gap: 24px;
  padding-inline: 16px;
  max-width: var(--page-max-width);
  width: 100%;
  margin: 0px auto;
  display: grid;
  --row: minmax(0,1fr);
  grid-template-columns: [page-start] var(--row) [prose-start] var(--row) var(--row) var(--row) var(--row) [prose-end] var(--row) [page-end];
  grid-gap: var(--gap);
}

.bento-item {
  display: flex;
  flex-direction: column;
  -webkit-box-align: center;
  align-items: flex-start;
  overflow: hidden;
  border-radius: 48px;
  padding: 46px 20px;
  position: relative;
  background: linear-gradient(rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.50) 100%);
  box-shadow: var(--bx-sh-1);
  &::before {
    content: "";
    pointer-events: none;
    user-select: none;
    position: absolute;
    inset: 0px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.37));
    -webkit-mask: linear-gradient(white, white) content-box content-box, linear-gradient(white, white);
    -webkit-mask-composite: xor;
  }
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  height: auto;
  min-height: 280px;
  margin-top: 16px;
}

.item-1 {
  grid-column: auto / span 4;
  @media screen and (max-width: 991px) {
    grid-area: span 1 / span 6;
    align-self: stretch;
  }
}

.item-2 {
  grid-column: auto / span 2;
  padding: 48px;
  --order: 1;
  @media screen and (max-width: 991px) {
    grid-area: span 1 / span 6;
    padding-inline: 24px;
  }
}

.item-3 {
  grid-column: auto / span 2;
  padding: 48px;
  --order: 2;
  @media screen and (max-width: 991px) {
    grid-area: span 1 / span 6;
    padding-inline: 24px;
    align-self: stretch;
  }
}

.item-4 {
  grid-column: 3 / -1;
  padding-inline: 0;
  @media screen and (max-width: 991px) {
    grid-area: span 1 / span 6;
    align-self: stretch;
  }
}

.item-min {
  grid-column: auto / span 2;
  padding: 38px 38px;
  @media screen and (max-width: 991px) {
    grid-area: span 1 / span 6;
    align-self: stretch;
  }
}


.stat-box {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-block: 1.75rem;
  border-bottom: 0.0625rem solid rgb(216 220 224);
  & .stat-items {
    display: flex;
    flex-direction: column;
  }
  & .stat-icon {
    display: grid;
    place-items: center;
    background: linear-gradient(310deg, rgb(238 146 12), rgb(253 252 33));
    width: 40px;
    height: 40px;
    border-radius: var(--radius-8);
    color: #fff;
    font-size: 1.8rem;
  }
  & .stat-title {
    color: rgb(103, 116, 142);
    font-weight: var(--weight-bold);
  }
}

.trophy-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 1.2rem;
}

.trophy-badge {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 64px;
  display: grid;
  place-items: center;
  position: relative;
  background: linear-gradient(310deg, rgb(238 146 12), rgb(253 252 33));
  box-shadow: rgba(255 210 96 / 24%) 0rem 0.25rem 0.375rem -0.0625rem, rgba(255 197 51 / 38%) 0rem 0.125rem 0.25rem -0.0625rem;
  &::before {
    content: "";
    pointer-events: none;
    user-select: none;
    position: absolute;
    inset: 0px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(rgb(253 252 33 / 50%), rgb(238 146 12 / 37%));
    -webkit-mask: linear-gradient(white, white) content-box content-box, linear-gradient(white, white);
    -webkit-mask-composite: xor;
  }
}

.table-wrapper {
  width: 100%;
  max-height: 200px;
  overflow-y: scroll;
  position: relative;
}

table {
  display: table;
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0px;
  & thead {
    & tr {

      & th {
        position: sticky;
        top: 0;
        background: rgb(0 0 0 / 90%);
        backdrop-filter: blur(30px);
        display: table-cell;
        text-align: center;
        padding: 0.5rem 2rem;
        color: #fff;
        font-size: 1.3rem;
        font-family: var(--font-secondary);
        font-weight: 500;
        &:not(:first-child){
          text-align: left;
        }
        &:first-child {
          width: 10%;
          padding-inline: 3.5rem;
        }
      }
    }
  }
  & tbody {
    display: table-row-group;
    & tr {
      color: inherit;
      display: table-row;
      vertical-align: middle;
      outline: 0px;
      &:hover {
        background: #ffffff85;
      }
      & td {
        font-size: 1.3rem;
        font-weight: 500;
        line-height: 1.6;
        letter-spacing: 0.01071em;
        display: table-cell;
        vertical-align: inherit;
        text-align: center;
        color: var(--subtitle);
        padding: 1.3rem 2rem;
        border-bottom: 0.0625rem solid rgb(216 220 224);
        &:not(:first-child){
          text-align: left;
        }
        &:first-child {
          width: 10%;
          padding-inline: 3.5rem;
        }
      }
    }
  }
}

import chartMinJs from "https://esm.sh/chart.min.js";

document.addEventListener('DOMContentLoaded', function() {
  
  // For Chart 2 Summery
  const /** {NodeElement} */ $avg = document.getElementById("avg");
  
  let data = [1, 1, 1.2, 1, 1.7, 1.5];
  
  // Calculate the average
  let average = data.reduce((sum, value) => sum + value, 0) / data.length;
  
 $avg.innerHTML = `${average.toFixed(1)} hrs`;
  
  
  

  let chart;

  const ctx = document.getElementById('chart').getContext('2d');
  const ctx2 = document.getElementById('chart2').getContext('2d');

  let colorA = "251 189 8";
  let colorB = "238 146 12";
  let colorC = "253 252 33";
  
  var gradient = ctx.createLinearGradient(0, 0, 0, 175);
  gradient.addColorStop(1, 'rgb(253 252 33 / 0%)');   
  gradient.addColorStop(0, 'rgb(238 146 12 / 40%)');
  
  Chart.defaults.font.size = 10;

  chart = new Chart(ctx, {
    type: "line",
    data: {
    labels: ["Day 1", "Day 2", "Day 3", "Day 4", "Day 5", "Day 6"],
    datasets: [
      {
        label: "Your BMI",
        data: [28.3, 28, 27, 27.6, 25, 25.6],
        backgroundColor : gradient,
        borderColor: `rgb(${colorA})`,
        borderWidth: 2,
        pointBorderWidth: 5,
        pointBackgroundColor: `rgb(${colorA})`,
        pointHoverBackgroundColor: `rgb(${colorA})`,
        pointBorderColor: 'rgb(' + colorA + '/' + '40%)',
        pointHoverBorderColor: 'rgb(' + colorC + '/' + '40%)',
        pointHoverRadius: 5,
        fill: 'origin',
        tension: 0.25,
      }]
    },
    options: {
      maintainAspectRatio: false,
      color: "rgb(144 158 186)",
      scales: {
        y: {
            beginAtZero: true,
            stacked: true,
            grid: {
              display: true,
              color: "rgb(216 220 224)",
              lineWidth: 1,
            },
            ticks: {
              color: "rgb(144 158 186)",
              padding: 8
            },
            border: {
              display: false,
              dash: [6, 6],
              dashOffset: -4,
            }
        },
        x: {
            grid: {
              display: false
            },
            border: {
              display: false
            },
            ticks: {
              color: "rgb(144 158 186)",
              padding: 10
            },
          }
        },
       
      }
  });
  
  
  chart = new Chart(ctx2, {
    type: "bar",
    data: {
    labels: ["Day 1", "Day 2", "Day 3", "Day 4", "Day 5", "Day 6"],
    datasets: [
      {
        label: "Your Movement (hrs)",
        data: [1, 1, 1.2, 1, 1.7, 1.5],
        backgroundColor : gradient,
        borderColor: `rgb(${colorA})`,
        borderWidth: 2,
        pointBorderWidth: 5,
        pointBackgroundColor: `rgb(${colorA})`,
        pointHoverBackgroundColor: `rgb(${colorA})`,
        pointBorderColor: 'rgb(' + colorA + '/' + '40%)',
        pointHoverBorderColor: 'rgb(' + colorC + '/' + '40%)',
        pointHoverRadius: 5,
        fill: 'origin',
        tension: 0.25,
      }]
    },
    options: {
      maintainAspectRatio: false,
      color: "rgb(144 158 186)",
      scales: {
        y: {
            beginAtZero: true,
            stacked: true,
            grid: {
              display: true,
              color: "rgb(216 220 224)",
              lineWidth: 1,
            },
            ticks: {
              color: "rgb(144 158 186)",
              padding: 8
            },
            border: {
              display: false,
              dash: [6, 6],
              dashOffset: -4,
            }
        },
        x: {
            grid: {
              display: false
            },
            border: {
              display: false
            },
            ticks: {
              color: "rgb(144 158 186)",
              padding: 10
            },
          }
        },
       
      }
  });

  
  
});

External CSS

  1. https://codepen.io/Yogu/pen/zYeyRxE.css

External JavaScript

  1. https://codepen.io/Yogu/pen/zYeyRxE.js