Character
Nia y Nio, los dos personajes que cuidan la luz. Nia vigila, encuentra, arregla y celebra; Nio duerme hasta que algo lo necesita.
import { Character } from '@sypnia/ui/react'
Las ocho poses
nia-watchingNia watches: nothing is wrong
nia-foundNia found something
nia-fixingNia is fixing it
nia-celebratingNia celebrates
nio-sleepingNio sleeps: nothing here yet
nio-one-eyeNio opens one eye
nio-startledNio is startled
nio-stretchingNio wakes up
Código
import { Character, type CharacterName } from '@sypnia/ui/react';
const poses: [CharacterName, string][] = [
['nia-watching', 'Nia watches: nothing is wrong'], ['nia-found', 'Nia found something'], ['nia-fixing', 'Nia is fixing it'], ['nia-celebrating', 'Nia celebrates'],
['nio-sleeping', 'Nio sleeps: nothing here yet'], ['nio-one-eye', 'Nio opens one eye'], ['nio-startled', 'Nio is startled'], ['nio-stretching', 'Nio wakes up'],
];
export default function Poses() {
return (
<div className="sy-grid" style={{ '--min': '9rem', '--gap': 'var(--s-5)' } as React.CSSProperties}>
{poses.map(([name, says]) => (
<figure key={name} className="sy-stack" style={{ '--gap': 'var(--s-2)', margin: 0, alignItems: 'center', textAlign: 'center' } as React.CSSProperties}>
<Character name={name} size="6.5rem" />
<figcaption className="sy-text--xs sy-text--muted"><code>{name}</code><br />{says}</figcaption>
</figure>
))}
</div>
);
} En un lugar vacío
El personaje da el ánimo; las palabras dicen qué va aquí, y el botón lo llena.
No problems yet
When your app reports its first error, it shows here, grouped by its cause.
Código
import { Button, Character } from '@sypnia/ui/react';
// In an empty place, the character says the mood; the words say what goes here and the button fills it.
export default function Empty() {
return (
<div className="sy-stack" style={{ '--gap': 'var(--s-3)', alignItems: 'center', textAlign: 'center', padding: 'var(--s-5) 0' } as React.CSSProperties}>
<Character name="nio-sleeping" size="8rem" />
<p className="sy-display sy-display--xs">No problems yet</p>
<p className="sy-text--muted" style={{ maxWidth: '26rem' }}>When your app reports its first error, it shows here, grouped by its cause.</p>
<Button variant="primary">Connect your app</Button>
</div>
);
} Cuándo usarlo
Úsalo cuando
- Estados vacíos, una espera larga, una búsqueda sin resultados, un momento para celebrar.
- Como mucho un personaje por pantalla.
No lo uses cuando
- Errores que necesitan acción ya: importan las palabras y el botón, no el ánimo.
- Decorar cada página: significan algo cuando aparecen.
Para todos
- Un personaje es decoración a menos que tenga
label; dáselo solo cuando diga algo que las palabras no dicen.
Props
| Character | Tipo | Por defecto |
|---|---|---|
nameobligatorioWho, and in which pose: Nia watches, finds, fixes and celebrates; Nio sleeps, opens one eye, startles and stretches. | "nia-watching" | "nia-found" | "nia-fixing" | "nia-celebrating" | "nio-sleeping" | "nio-one-eye" | "nio-startled" | "nio-stretching" | |
className | string | |
labelWhat the picture says, for screen readers. Leave it out when the words beside it already say it. | string | |
sizeWidth, as CSS. Default 7.5rem. | string |