Ir al contenido

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'

En esta página
  1. Registro, con el panel lateral
  2. Simple, para mensajes
  3. Skeleton
  4. Astro
  5. Cuándo usarlo
  6. Para todos
  7. Props

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.

Create your account

It takes a minute. No card needed.

Already have an account? Sign in

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

Invitations work for 7 days. Ask the person who invited you to send a new one.
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.

Create an account

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.

Back to sign in

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.
  • aside para 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 main de la página y su título el único h1.
  • 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

AuthLayoutTipoPor defecto
after

One line under the card: «New to Sypnia? Create an account».

ReactNode
aside

Beside 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
brand

The mark at the top. Defaults to the Sypnia logo.

ReactNode
brandHref

Where the mark leads. Without it the mark is not a link.

string
className string
footer

The bottom line: terms, privacy, help.

ReactNode
lead

One sentence under the title: what happens here, or what to do next.

ReactNode
plain

No card around the content: for error and not-found pages, which say one thing and offer a way out.

boolean
title

What this step is, in the voice: «Sign in to Sypnia», «Check your email». It is the page's only h1.

ReactNode
top

The 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
AuthLayoutSkeletonTipoPor defecto
aside boolean
fields

How many fields the step will have.

number 2
plain boolean
width "sm" | "md" sm
  1. Registro, con el panel lateral
  2. Simple, para mensajes
  3. Skeleton
  4. Astro
  5. Cuándo usarlo
  6. Para todos
  7. Props

    Busca páginas, secciones y términos