Ir al contenido

CaseMap

El mapa de casos de uso de un producto, dibujado como una constelación: cada punto de luz es algo que una persona puede hacer, cada línea un flujo entre ellos. Un pulso sigue un recorrido.

import { CaseMap, CaseMapSkeleton } from '@sypnia/ui/react'

En esta página
  1. Una panadería
  2. En Astro
  3. Skeleton
  4. Cuándo usarlo
  5. Para todos
  6. Props

Una panadería

CustomerBakeryPublish the menuof the daySee the menuof the daySee the salesof the dayPlace an orderHear aboutan orderMark an orderas readyFollow my orderLeave a reviewfuera del mapa
Los casos de uso, en palabras
  • Publish the menu of the day → See the menu of the day
  • See the menu of the day → Place an order
  • See the sales of the day
  • Place an order → Hear about an order y Follow my order
  • Hear about an order → Mark an order as ready y See the sales of the day
  • Mark an order as ready → Follow my order
  • Follow my order

Leave a review: fuera del mapa

Chosen: Place an order

Código
import { useState } from 'react';
import { CaseMap } from '@sypnia/ui/react';

// The use cases of a bakery. The pulse follows one customer; the dim point is a request outside the map.
// Press a case to choose it.
const cases = [
  { id: 'publish', name: 'Publish the menu\nof the day', x: 440, y: 60 },
  { id: 'menu', name: 'See the menu\nof the day', x: 150, y: 118 },
  { id: 'sales', name: 'See the sales\nof the day', x: 580, y: 150 },
  { id: 'order', name: 'Place an order', x: 292, y: 214, focal: true },
  { id: 'notice', name: 'Hear about\nan order', x: 478, y: 252 },
  { id: 'ready', name: 'Mark an order\nas ready', x: 552, y: 372 },
  { id: 'follow', name: 'Follow my order', x: 292, y: 382 },
  { id: 'review', name: 'Leave a review', x: 92, y: 300, out: true },
];
const edges = [
  { from: 'publish', to: 'menu', bend: -0.18 }, { from: 'menu', to: 'order', bend: 0.16 }, { from: 'order', to: 'notice', bend: -0.12 },
  { from: 'notice', to: 'ready', bend: 0.14 }, { from: 'ready', to: 'follow', bend: 0.12 }, { from: 'order', to: 'follow', bend: -0.22 },
  { from: 'notice', to: 'sales', bend: -0.2 },
];
export default function Bakery() {
  const [chosen, setChosen] = useState<string | null>('order');
  return (
    <div className="sy-stack">
      <CaseMap label="Use cases of La Espiga, a bakery" cases={cases} edges={edges} journey={['menu', 'order', 'notice', 'ready', 'follow']}
        actors={{ start: 'Customer', end: 'Bakery' }} selected={chosen} onSelect={setChosen} />
      <p className="sy-text--muted">Chosen: <b>{cases.find((c) => c.id === chosen)?.name.replace('\n', ' ')}</b></p>
    </div>
  );
}

En Astro

Patient Clinic Book anappointment Get a reminder Check in Pay online outside the scope
Los casos de uso, en palabras
  • Book an appointment → Get a reminder
  • Get a reminder → Check in
  • Check in

Pay online: outside the scope

Código
---
// The Astro twin, for landing pages and docs: no JavaScript, the same map and the same words.
import CaseMap from '@sypnia/ui/astro/CaseMap.astro';
---
<CaseMap label="Use cases of a clinic" width={520} height={300} idPrefix="clinic" actors={{ start: 'Patient', end: 'Clinic' }}
  cases={[
    { id: 'book', name: 'Book an\nappointment', x: 120, y: 110, focal: true },
    { id: 'remind', name: 'Get a reminder', x: 300, y: 70 },
    { id: 'attend', name: 'Check in', x: 400, y: 190 },
    { id: 'pay', name: 'Pay online', x: 200, y: 240, out: true, note: 'outside the scope' },
  ]}
  edges={[{ from: 'book', to: 'remind', bend: -0.15 }, { from: 'remind', to: 'attend', bend: 0.18 }]}
  journey={['book', 'remind', 'attend']} />

Skeleton

Write a postRead a postComment
Los casos de uso, en palabras
  • Write a post → Read a post
  • Read a post → Comment
  • Comment
Código
import { CaseMap, CaseMapSkeleton } from '@sypnia/ui/react';

// A small map and its skeleton: the frame of the map at its shape.
export default function Skeleton() {
  return (
    <div className="sy-cols sy-cols--stack">
      <CaseMap label="Use cases of a blog" width={420} height={300} cases={[
        { id: 'write', name: 'Write a post', x: 110, y: 90, focal: true }, { id: 'read', name: 'Read a post', x: 300, y: 150 }, { id: 'comment', name: 'Comment', x: 160, y: 230 },
      ]} edges={[{ from: 'write', to: 'read', bend: 0.12 }, { from: 'read', to: 'comment', bend: -0.15 }]} journey={['write', 'read', 'comment']} />
      <CaseMapSkeleton width={420} height={300} />
    </div>
  );
}

Cuándo usarlo

Úsalo cuando

  • Explicar qué hace un producto, desde el lado de quienes lo usan.
  • Mostrar un pedido que queda fuera del mapa: un error de alcance.

No lo uses cuando

  • Pasos de un proceso con flechas y etiquetas: usa FlowDiagram.

Para todos

  • El mapa siempre se cuenta en palabras: cada caso y a dónde lleva.
  • Con onSelect cada caso es un botón; Enter o Espacio lo eligen.
  • El pulso se detiene para quien pide menos movimiento.

Props

CaseMapTipoPor defecto
casesobligatorio UseCase[]
edgesobligatorio CaseEdge[]
labelobligatorio

What the map is: «Use cases of La Espiga».

string
actors

Who acts, written in the corners: { start: 'Customer', end: 'Bakery' }.

{ start?: string; end?: string; } | undefined
height number 470
journey

Case ids in order: the pulse travels along them. Each pair must be an edge.

string[] []
onSelect ((id: string) => void)
selected string | null
width

The map's own units. Positions of the cases are in these.

number 640
CaseMapSkeletonTipoPor defecto
height number 470
width number 640
  1. Una panadería
  2. En Astro
  3. Skeleton
  4. Cuándo usarlo
  5. Para todos
  6. Props

    Busca páginas, secciones y términos