# Sector atlas

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

[View Sector atlas on CyberSpec](https://www.cyberspec.dev/sink/sector-atlas)

## 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.

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

## Usage

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

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

## Source

```tsx
"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](https://www.cyberspec.dev/components/sidebar/map.md) — A flat map or rotatable globe with selectable markers, routes, and a bundled world basemap.
- [Segmented control](https://www.cyberspec.dev/components/sidebar/segmented-control.md) — A row of segments with an indicator that slides to the choice.

## Resources

- [All kitchen sink recipes](https://www.cyberspec.dev/sink.md)
- [Recipe source on GitHub](https://github.com/agnelnieves/cyberspec/blob/main/registry/cyber/recipes/sector-atlas.tsx)
- [Recipe layout stylesheet](https://github.com/agnelnieves/cyberspec/blob/main/registry/cyber/recipes/recipe-layout.css)
- [Shadcn registry item](https://www.cyberspec.dev/r/sector-atlas.json)
