Skip to content

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

3.0 KB
Raw Blame
---
import { Image } from "astro:assets";
import wallpaper from "@/assets/wallpapers/desktop-02.jpg";
import Crab from "@/components/crab/Crab.astro";
import UsageIsland from "@/components/dock/UsageIsland.astro";
import Section from "@/components/layout/Section.astro";
import SectionIntro from "@/components/showcase/SectionIntro.astro";
import { usageFacts, usageIntro } from "@/data/usage";
import "@/styles/showcase.css";
import "@/styles/usage.css";
---

<Section id="ai-usage">
  <SectionIntro {...usageIntro} />

  <div class="usage" data-r>
    <figure class="usage-desk" aria-label="The menu bar with the AI usage island open (example values)">
      <Image src={wallpaper} alt="" class="usage-wall" widths={[560, 1120]} sizes="(min-width: 1024px) 560px, 100vw" />
      <div class="usage-bar" aria-hidden="true">
        <b>Terminal</b>
        <span class="tabular-nums">9:41</span>
      </div>
      <UsageIsland mode="open" class="usage-island" />
      <Crab cell={2.5} class="crab-free" interactive label="The crab cheering a limit reset. Click it." data-usage-crab />
      <figcaption>Example values</figcaption>
    </figure>

    <ul class="usage-facts">
      {
        usageFacts.map(({ title, body }) => (
          <li data-r>
            <b>{title}</b>
            <span>{body}</span>
          </li>
        ))
      }
    </ul>
  </div>
</Section>

<script>
  import { initUsageCrab } from "@/scripts/crab-spots";
  import { initReveal } from "@/scripts/reveal";

  const section = document.querySelector<HTMLElement>("#ai-usage");
  if (section) {
    initReveal(section);
    initUsageCrab(section);
  }
</script>

<style>
  .usage {
    display: grid;
    gap: 40px;
    align-items: center;
    margin-top: 56px;
  }

  @media (min-width: 1024px) {
    .usage {
      grid-template-columns: 1.15fr 1fr;
      gap: 56px;
    }
  }

  .usage-desk {
    position: relative;
    margin: 0;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 22px;
    box-shadow: 0 30px 70px rgb(0 0 0 / 0.22);
  }

  .usage-wall {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .usage-bar {
    position: absolute;
    inset: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 28px;
    padding: 0 14px;
    font-size: 12px;
    color: #fff;
    background: rgb(0 0 0 / 0.28);
    backdrop-filter: blur(14px) saturate(160%);
  }

  .usage-desk figcaption {
    position: absolute;
    right: 14px;
    bottom: 12px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    color: #fff;
    background: rgb(0 0 0 / 0.35);
  }

  .usage-facts {
    display: grid;
    gap: 22px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .usage-facts li {
    display: grid;
    gap: 4px;
    padding-left: 16px;
    border-left: 2px solid var(--color-line);
  }

  .usage-facts b {
    font-size: 1.05rem;
  }

  .usage-facts span {
    color: var(--color-mute);
    line-height: 1.55;
  }
</style>