Sector atlas

Follow three observatories across a globe, select a site, and switch to a flat chart.

Installation

Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.

bunx --bun shadcn@latest add https://www.cyberspec.dev/r/sector-atlas.json

Usage

import { Cyber } from "@/components/ui/cyber"
import Recipe from "@/components/recipes/sector-atlas"

export default function App() {
  return (
    <Cyber>
      <Recipe />
    </Cyber>
  )
}

Source

"use client"

import { useState } from "react"
import { Globe, Map as MapIcon } from "lucide-react"
import { Map, type MapMarker, type MapProjection } from "@/components/ui/map"
import { SegmentedControl } from "@/components/ui/segmented-control"
import "./recipe-layout.css"

const observatories: MapMarker[] = [
  { id: "mauna-kea", code: "MK", label: "Mauna Kea", coordinate: [-155.47, 19.82] },
  { id: "paranal", code: "PN", label: "Cerro Paranal", coordinate: [-70.40, -24.63] },
  { id: "la-palma", code: "LP", label: "La Palma", coordinate: [-17.89, 28.76] },
]
const relays = [
  { id: "pacific", from: "mauna-kea", to: "paranal" },
  { id: "atlantic", from: "paranal", to: "la-palma" },
]

export default function SectorAtlas() {
  const [projection, setProjection] = useState<MapProjection>("globe")
  const [selected, setSelected] = useState<string | null>("paranal")
  return (
    <div className="sink-stack">
      <Map label="Observatory network" markers={observatories} routes={relays} projection={projection}
        value={selected} onValueChange={setSelected} />
      <SegmentedControl<MapProjection> label="Projection" value={projection}
        options={[{ label: "Globe", value: "globe", icon: <Globe /> }, { label: "Flat map", value: "mercator", icon: <MapIcon /> }]}
        onValueChange={next => next && setProjection(next)} />
    </div>
  )
}

Components in this recipe

  • Map — A flat map or rotatable globe with selectable markers, routes, and a bundled world basemap.
  • Segmented control — A row of segments with an indicator that slides to the choice.

Resources

View as Markdown