AuthLayout
El marco de las páginas fuera de la consola: iniciar sesión, registrarse, recuperar la contraseña, invitaciones, errores. La marca arriba, una tarea en el medio y el camino a la otra tarea debajo.
import { AuthLayout, AuthLayoutSkeleton } from '@sypnia/ui/react'
Registro, con el panel lateral
Con espacio suficiente, la tarea va a un lado y lo que la persona obtiene al otro. Angosta la ventana: el panel lateral se va.
Código
import { AuthLayout, Button, EmailInput, Field, List, ListItem, Says } from '@sypnia/ui/react';
// The mark on top, one task in the card, the other task under it, and what the person gets beside it when there is room.
export default function Basic() {
return (
<AuthLayout title="Create your account" lead="It takes a minute. No card needed." brandHref="#"
after={<>Already have an account? <a href="#sign-in">Sign in</a></>}
aside={<><Says size="lg">Every bug leaves a light on.</Says><List label="What you get"><ListItem icon="check" title="Errors, traces and replays in one place" /><ListItem icon="check" title="Your data stays in your region" /></List></>}
footer={<><a href="#terms">Terms</a><a href="#privacy">Privacy</a></>}>
<Field label="Work email"><EmailInput name="email" /></Field>
<Button variant="primary" block>Continue</Button>
</AuthLayout>
);
} Simple, para mensajes
Sin tarjeta: una invitación vencida, un error, una página que no existe.
This invitation has expired
Código
import { AuthLayout, Button, EmptyState } from '@sypnia/ui/react';
// Without the card: a page that says one thing and offers a way out, like an expired invitation.
export default function Plain() {
return (
<AuthLayout plain brandHref="#">
<EmptyState icon="mail" title="This invitation has expired"
actions={<><Button variant="primary" href="#sign-in">Sign in</Button><Button href="#help">Ask for a new one</Button></>}>
Invitations work for 7 days. Ask the person who invited you to send a new one.
</EmptyState>
</AuthLayout>
);
} Skeleton
El marco y su skeleton lado a lado: el mismo marco y las mismas cajas.
Sign in
Use the email you signed up with.
Código
import { AuthLayout, AuthLayoutSkeleton, Button, Columns, EmailInput, Field, PasswordInput } from '@sypnia/ui/react';
// The layout and its skeleton side by side: the same frame, the same boxes.
export default function Skeleton() {
return (
<Columns cols={2} stack>
<AuthLayout title="Sign in" lead="Use the email you signed up with." after={<a href="#sign-up">Create an account</a>}>
<Field label="Email"><EmailInput name="email" /></Field>
<Field label="Password"><PasswordInput name="password" /></Field>
<Button variant="primary" block>Sign in</Button>
</AuthLayout>
<AuthLayoutSkeleton fields={2} />
</Columns>
);
} Astro
El mismo marco sin JavaScript, para páginas estáticas: slots para after, aside, footer, brand y top.
Check your email
We sent a link to ana@northwind.io. It works for 30 minutes.
Wrong address? Start again
Código
---
import AuthLayout from '@sypnia/ui/astro/AuthLayout.astro';
import Button from '@sypnia/ui/astro/Button.astro';
---
<AuthLayout title="Check your email" lead="We sent a link to ana@northwind.io. It works for 30 minutes." brandHref="#">
<Button href="#sign-in" icon="arrow-left">Back to sign in</Button>
<Fragment slot="after">Wrong address? <a href="#sign-up">Start again</a></Fragment>
<Fragment slot="footer"><a href="#terms">Terms</a><a href="#privacy">Privacy</a></Fragment>
</AuthLayout> Cuándo usarlo
Úsalo cuando
- Toda página que una persona ve antes de la consola: iniciar sesión, registrarse, recuperar, aceptar una invitación, verificar un correo.
- Páginas de error y de no encontrado fuera de la consola, con
plain: sin tarjeta, un mensaje y una salida. asidepara lo que la persona obtiene. Solo aparece cuando el marco mide 60rem o más.
No lo uses cuando
- Páginas detrás del inicio de sesión: viven en el AppShell.
- Más de una tarea en la tarjeta: un paso por página, con un enlace a la otra tarea debajo.
- Cualquier cosa necesaria para terminar la tarea dentro de
aside: los celulares nunca la ven.
Para todos
- La tarjeta es la región
mainde la página y su título el únicoh1. - Cuando el título cambia (el siguiente paso de un flujo), el foco pasa a él y un lector de pantalla lo lee.
- Los enlaces del pie y la marca miden al menos 44 px de alto.
Props
| AuthLayout | Tipo | Por defecto |
|---|---|---|
afterOne line under the card: «New to Sypnia? Create an account». | ReactNode | |
asideBeside the card when the layout is wide enough (60rem and more): what the person gets, a quote. Hidden on narrower screens, so nothing in it may be needed to finish the task. | ReactNode | |
brandThe mark at the top. Defaults to the Sypnia logo. | ReactNode | |
brandHrefWhere the mark leads. Without it the mark is not a link. | string | |
className | string | |
footerThe bottom line: terms, privacy, help. | ReactNode | |
leadOne sentence under the title: what happens here, or what to do next. | ReactNode | |
plainNo card around the content: for error and not-found pages, which say one thing and offer a way out. | boolean | |
titleWhat this step is, in the voice: «Sign in to Sypnia», «Check your email». It is the page's only h1. | ReactNode | |
topThe end of the top bar: a LanguageSwitch, a way back to the site. | ReactNode | |
width`sm` (26rem) for one or two fields, `md` (34rem) for longer forms and step-by-step tasks. | "sm" | "md" | sm |
| AuthLayoutSkeleton | Tipo | Por defecto |
|---|---|---|
aside | boolean | |
fieldsHow many fields the step will have. | number | 2 |
plain | boolean | |
width | "sm" | "md" | sm |