Skip to content

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

1.5 KB
Raw Blame
---
interface Props {
  href: string;
  variant?: "primary" | "secondary" | "inverse";
  size?: "md" | "sm";
  /** Leaves the landing: opens in a new tab, so the page is not thrown away. */
  external?: boolean;
  class?: string;
}

const { href, variant = "primary", size = "md", external = false, class: className } = Astro.props;

const base = [
  "inline-flex items-center gap-2.5 squircle-pill border-[1.5px]",
  "font-bold tracking-[-0.01em] transition-transform duration-[180ms]",
  "ease-[cubic-bezier(.34,1.56,.64,1)] hover:-translate-y-0.5 hover:scale-[1.02]",
  "focus-visible:outline-2 focus-visible:outline-offset-[3px] focus-visible:outline-primary",
];

const sizes = {
  md: "h-[52px] px-[22px]",
  sm: "h-10 px-4 text-[14px]",
};

const variants = {
  primary: [
    "border-ink bg-primary-gradient text-ink shadow-[0_4px_0_var(--color-ink)]",
    "hover:shadow-[0_6px_0_var(--color-ink)]",
    "active:translate-y-[3px] active:scale-[.98] active:shadow-[0_1px_0_var(--color-ink)]",
  ],
  secondary: ["border-fg text-fg", "active:translate-y-px active:scale-[.98]"],
  inverse: [
    "border-ink bg-ink text-primary-end shadow-[0_4px_0_rgb(6_22_28/0.28)]",
    "hover:shadow-[0_6px_0_rgb(6_22_28/0.28)]",
    "active:translate-y-[3px] active:scale-[.98] active:shadow-[0_1px_0_rgb(6_22_28/0.28)]",
  ],
};
---

<a
  href={href}
  target={external ? "_blank" : undefined}
  rel={external ? "noopener noreferrer" : undefined}
  class:list={[base, sizes[size], variants[variant], className]}
>
  <slot />
</a>