Skip to content

A lightweight, macOS-style dock for Windows 11, with glass visuals, smooth magnification, and Genie effect.

1.6 KB
Raw Blame
---
import { stats } from "@/data/stats";

interface Props {
  class?: string;
}

const { class: className } = Astro.props;

/** "0.5" shows one decimal while counting; "16" must not flicker through "16.0". */
const decimalsOf = (value: string) => (value.split(".")[1] ?? "").length;
---

<dl
  aria-label="Muelle performance metrics"
  class:list={[
    "stat-strip grid grid-cols-2 overflow-hidden squircle-lg border border-white/10 sm:grid-cols-4",
    className,
  ]}
>
  {
    stats.map(({ value, unit, label }) => (
      <div class="stat flex min-h-[104px] flex-col justify-center px-5 py-5 text-left sm:px-7">
        <dt class="font-mono text-[10px] tracking-[0.12em] text-white/45 uppercase">{label}</dt>
        <dd class="mt-1 flex items-baseline gap-1.5">
          <span class="text-3xl font-semibold tracking-[-0.05em] text-white tabular-nums sm:text-4xl">
            <span data-counter data-to={value} data-decimals={decimalsOf(value)}>
              {value}
            </span>
          </span>
          {unit && <span class="font-mono text-xs text-white/55">{unit}</span>}
        </dd>
      </div>
    ))
  }
</dl>

<script>
  import { initCounters } from "@/scripts/counters";

  initCounters(document);
</script>

<style>
  .stat-strip {
    background: linear-gradient(145deg, #111214, #090a0c);
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.035);
  }

  .stat + .stat {
    border-left: 1px solid rgb(255 255 255 / 0.08);
  }

  @media (max-width: 639px) {
    .stat:nth-child(3) {
      border-left: 0;
    }

    .stat:nth-child(n + 3) {
      border-top: 1px solid rgb(255 255 255 / 0.08);
    }
  }
</style>