# Geist Flight

A flight with its route, times, status and price.

Build a Flight in this project that looks and behaves like Geist's. Measured from the running Geist app (vercel.com/geist). Keep every value exact. Map the tokens onto the project's own theme variables instead of hard-coding them. Use the project's own component library for behaviour, or Base UI primitives if it has none.

Fidelity: Concept, not a real feature. Designed from Geist's Card (6px radius, border shadow), small Badge and Geist's type scale. No reference shows a flight. The status is a small subtle Badge coloured by data-status, and the route uses a dashed hairline with the plane icon.

## Tokens

| Token | Light | Dark |
| --- | --- | --- |
| `--ds-background-100` | `hsl(0 0% 100%)` | `hsl(0 0% 4%)` |
| `--ds-background-200` | `hsl(0 0% 98%)` | `hsl(0 0% 0%)` |
| `--ds-gray-200` | `hsl(0 0% 92%)` | `hsl(0 0% 12%)` |
| `--ds-gray-700` | `hsl(0 0% 56%)` | `hsl(0 0% 56%)` |
| `--ds-gray-900` | `hsl(0 0% 30%)` | `hsl(0 0% 63%)` |
| `--ds-gray-1000` | `hsl(0 0% 9%)` | `hsl(0 0% 93%)` |
| `--ds-gray-alpha-400` | `#00000014` | `#ffffff24` |
| `--ds-gray-alpha-500` | `#00000036` | `#ffffff3d` |
| `--ds-red-200` | `oklch(95.41% 0.0299 14.2526)` | `oklch(25.93% 0.0834 19.02)` |
| `--ds-red-900` | `oklch(54.99% 0.232 25.29)` | `oklch(69.96% 0.2136 22.03)` |
| `--ds-amber-200` | `oklch(96.81% 0.0495 90.2423)` | `oklch(24.95% 0.0642 64.78)` |
| `--ds-amber-900` | `oklch(52.79% 0.1496 54.65)` | `oklch(77.21% 0.1991 64.28)` |
| `--ds-green-200` | `oklch(96.92% 0.037 147.15)` | `oklch(27.12% 0.0895 150.09)` |
| `--ds-green-900` | `oklch(51.75% 0.1453 147.65)` | `oklch(73.1% 0.2158 148.29)` |
| `--ds-shadow-border` | `0 0 0 1px #00000014, 0 0 0 1px var(--ds-background-200)` | `0 0 0 1px #ffffff25, 0 0 0 1px #000` |
| `--font-monospace` | `"Geist Mono Variable", "Geist Mono", Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace` | `"Geist Mono Variable", "Geist Mono", Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace` |
| `--font-size-micro` | `0.75rem` | `0.75rem` |
| `--font-size-mini` | `0.8125rem` | `0.8125rem` |
| `--font-size-small` | `0.875rem` | `0.875rem` |
| `--font-size-regular` | `1rem` | `1rem` |
| `--font-weight-medium` | `500` | `500` |
| `--font-weight-semibold` | `600` | `600` |
| `--radius-control` | `6px` | `6px` |
| `--radius-rounded` | `9999px` | `9999px` |

## CSS

Scoped under `[data-style="geist"]`; dark rules sit under `[data-theme="dark"]`. The `ui-*` classes and data attributes match the structure below.

```css
[data-style="geist"] {
  .ui-flight {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    border-radius: var(--radius-control);
    background-color: var(--ds-background-100);
    box-shadow: var(--ds-shadow-border);
    color: var(--ds-gray-1000);
    font-size: var(--font-size-small);
    line-height: 20px;
    font-variant-numeric: tabular-nums;
  }

  .ui-flight-header {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ds-gray-alpha-400);
  }

  .ui-flight-airline {
    overflow: hidden;
    color: var(--ds-gray-1000);
    font-weight: var(--font-weight-medium);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ui-flight-number {
    flex-shrink: 0;
    color: var(--ds-gray-900);
    font-family: var(--font-monospace);
    font-size: var(--font-size-micro);
    line-height: 16px;
  }

  .ui-flight-status {
    box-sizing: border-box;
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    height: 20px;
    margin-left: auto;
    padding: 0 8px;
    border-radius: var(--radius-rounded);
    background-color: oklch(from var(--ds-gray-200) 0.94 c h);
    color: var(--ds-gray-1000);
    font-size: 11px;
    font-weight: var(--font-weight-medium);
    line-height: 20px;
    letter-spacing: 0.2px;
    white-space: nowrap;
  }

  .ui-flight:is([data-status="on-time"], [data-status="landed"]) .ui-flight-status {
    background-color: oklch(from var(--ds-green-200) 0.94 calc(c * 1.3) h);
    color: var(--ds-green-900);
  }

  .ui-flight[data-status="delayed"] .ui-flight-status {
    background-color: oklch(from var(--ds-amber-200) 0.94 calc(c * 1.3) h);
    color: var(--ds-amber-900);
  }

  .ui-flight[data-status="cancelled"] .ui-flight-status {
    background-color: oklch(from var(--ds-red-200) 0.94 calc(c * 1.3) h);
    color: var(--ds-red-900);
  }

  .ui-flight-route {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    padding: 20px 16px;
  }

  .ui-flight-endpoint {
    display: flex;
    flex-shrink: 0;
    flex-direction: column;
    min-width: 0;

    &:last-child {
      align-items: flex-end;
      text-align: right;
    }
  }

  .ui-flight-time {
    color: var(--ds-gray-1000);
    font-size: 24px;
    font-weight: var(--font-weight-semibold);
    line-height: 32px;
    letter-spacing: -0.96px;
  }

  .ui-flight-code {
    color: var(--ds-gray-1000);
    font-family: var(--font-monospace);
    font-size: var(--font-size-mini);
    font-weight: var(--font-weight-medium);
    line-height: 18px;
  }

  .ui-flight-city {
    color: var(--ds-gray-900);
    font-size: var(--font-size-micro);
    line-height: 16px;
    white-space: nowrap;
  }

  .ui-flight-path {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0;
  }

  .ui-flight-duration,
  .ui-flight-stops {
    color: var(--ds-gray-900);
    font-size: var(--font-size-micro);
    line-height: 16px;
    white-space: nowrap;
  }

  .ui-flight-line {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    color: var(--ds-gray-900);

    &::before,
    &::after {
      content: "";
      flex: 1;
      height: 0;
      border-top: 1px dashed var(--ds-gray-alpha-500);
    }

    & svg {
      width: 16px;
      height: 16px;
      flex-shrink: 0;
    }
  }

  .ui-flight[data-status="cancelled"] :is(.ui-flight-time, .ui-flight-code) {
    color: var(--ds-gray-700);
    text-decoration: line-through;
  }

  .ui-flight-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px 16px;
    border-top: 1px solid var(--ds-gray-alpha-400);
    background-color: var(--ds-background-200);
  }

  .ui-flight-detail {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: var(--ds-gray-900);
    font-size: var(--font-size-mini);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ui-flight-price {
    color: var(--ds-gray-1000);
    font-size: var(--font-size-regular);
    font-weight: var(--font-weight-semibold);
    line-height: 24px;
    letter-spacing: -0.32px;
  }

  &[data-theme="dark"] {
    .ui-flight-status {
      background-color: oklch(from var(--ds-gray-200) 0.27 c h);
    }

    .ui-flight:is([data-status="on-time"], [data-status="landed"]) .ui-flight-status {
      background-color: oklch(from var(--ds-green-200) 0.27 calc(c * 1.3) h);
    }

    .ui-flight[data-status="delayed"] .ui-flight-status {
      background-color: oklch(from var(--ds-amber-200) 0.27 calc(c * 1.3) h);
    }

    .ui-flight[data-status="cancelled"] .ui-flight-status {
      background-color: oklch(from var(--ds-red-200) 0.27 calc(c * 1.3) h);
    }
  }
}
```

## Structure

How Replicas assembles it on Base UI.

```tsx
import type { ComponentProps, ReactNode } from "react";
import { join } from "./utils";

type RootProps = ComponentProps<"article"> & { status?: "scheduled" | "on-time" | "delayed" | "cancelled" | "landed" };

function Root({ className, status, ...props }: RootProps) {
  return <article className={join("ui-flight", className)} data-status={status} {...props} />;
}

const part = (name: string) =>
  function Part({ className, ...props }: ComponentProps<"div">) {
    return <div className={join(`ui-flight-${name}`, className)} {...props} />;
  };

const text = (name: string) =>
  function Text({ className, ...props }: ComponentProps<"span">) {
    return <span className={join(`ui-flight-${name}`, className)} {...props} />;
  };

type EndpointProps = Omit<ComponentProps<"div">, "children"> & { time: ReactNode; code: ReactNode; city?: ReactNode };

function Endpoint({ className, time, code, city, ...props }: EndpointProps) {
  return (
    <div className={join("ui-flight-endpoint", className)} {...props}>
      <span className="ui-flight-time">{time}</span>
      <span className="ui-flight-code">{code}</span>
      {city ? <span className="ui-flight-city">{city}</span> : null}
    </div>
  );
}

type PathProps = Omit<ComponentProps<"div">, "children"> & { duration: ReactNode; stops?: ReactNode };

function Path({ className, duration, stops, ...props }: PathProps) {
  return (
    <div className={join("ui-flight-path", className)} {...props}>
      <span className="ui-flight-duration">{duration}</span>
      <span className="ui-flight-line" aria-hidden>
        <svg viewBox="0 0 16 16" fill="currentColor">
          <path d="M14.5 8c0-.55-.45-1-1-1H10L6.75 2.5H5.5L7 7H4L3 5.5H2l.5 2.5L2 10.5h1L4 9h3l-1.5 4.5h1.25L10 9h3.5c.55 0 1-.45 1-1z" />
        </svg>
      </span>
      {stops ? <span className="ui-flight-stops">{stops}</span> : null}
    </div>
  );
}

export const Flight = {
  Root,
  Header: part("header"),
  Airline: text("airline"),
  Number: text("number"),
  Status: text("status"),
  Route: part("route"),
  Endpoint,
  Path,
  Footer: part("footer"),
  Detail: text("detail"),
  Price: text("price"),
};
```

## Example

```tsx
import { Button, Flight } from "@replicas/ui";

export default function FlightDemo() {
  return (
    <Flight.Root status="on-time" style={{ width: "100%", maxWidth: 480 }}>
      <Flight.Header>
        <Flight.Airline>Pacific Air</Flight.Airline>
        <Flight.Number>PA 482</Flight.Number>
        <Flight.Status>On time</Flight.Status>
      </Flight.Header>
      <Flight.Route>
        <Flight.Endpoint time="08:15" code="SFO" city="San Francisco" />
        <Flight.Path duration="5h 20m" stops="Nonstop" />
        <Flight.Endpoint time="16:35" code="JFK" city="New York" />
      </Flight.Route>
      <Flight.Footer>
        <Flight.Detail>Thu, Mar 14 · Economy</Flight.Detail>
        <Flight.Price>$289</Flight.Price>
        <Button variant="primary" size="small">
          Select
        </Button>
      </Flight.Footer>
    </Flight.Root>
  );
}
```

## Foundations

The rest of the Geist style, as a skill: https://replicas.raphaelsalaja.com/skills/geist/SKILL.md