Sign-in card

A small sign-in card: a strip of your colour that breaks into dots, one email field and one button.

Sign in

Enter your email and we will send you a sign-in link.

Options

Screen
Colour

Code

import { useState } from "react";
import "./sign-in-card.css";

export function SignInCard({ onSubmit }) {
  const [sentTo, setSentTo] = useState("");

  function send(event) {
    event.preventDefault();
    const email = event.currentTarget.elements.email.value.trim();
    onSubmit?.(email);
    setSentTo(email);
  }

  return (
    <section className="dh-signcard">
      <form className="dh-signcard-card" onSubmit={send}>
        <div className="dh-signcard-top">
          <svg viewBox="0 0 52 40" fill="currentColor" aria-hidden><path d="M52 40H33L25.6569 32.6569C24.596 31.596 24 30.1571 24 28.6569C24 25.5327 26.5327 23 29.6569 23H36L45 32H52V40ZM29 40H9L0 31V23H8.27208C10.659 23 12.9482 23.9482 14.636 25.636L29 40ZM19 12H0V3H28L31 0L46 15V23H36L22 9L19 12ZM0 13H10V14H0V13ZM0 15H10V16H0V15ZM0 17H10V18H0V17ZM0 19H10V20H0V19ZM0 21H10V22H0V21Z" /></svg>
        </div>
        <div className="dh-signcard-body">
          <h2>Sign in</h2>
          <p>Enter your email and we will send you a sign-in link.</p>
          <label>
            <span>Email</span>
            <input type="email" name="email" placeholder="[email protected]" autoComplete="email" required />
          </label>
          <button type="submit">Email me a sign-in link</button>
          {sentTo && <p className="dh-signcard-note" role="status">Check {sentTo} for your link.</p>}
        </div>
      </form>
    </section>
  );
}

Sign in

Enter your email and we will send you a sign-in link.