DDBS UI
commerce

Sign-in Modal

A demo sign in and sign up dialog that stores nothing and passes the first name back.

npx shadcn@latest add https://ui.develop-better-solutions.com/r/store-auth-modal.json
Fullscreen

Usage

store-auth-modal-example.tsx
"use client";

import { useState } from "react";
import { AuthModal } from "@dbs/ui";
import { StoreScope, triggerClass } from "./_store";

export default function StoreAuthModalExample() {
  const [open, setOpen] = useState(false);
  const [name, setName] = useState<string | null>(null);
  return (
    <StoreScope minHeight={660}>
      <button type="button" className={triggerClass} onClick={() => setOpen(true)}>
        {name ? `Signed in as ${name}` : "Sign in"}
      </button>
      <AuthModal
        open={open}
        onClose={() => setOpen(false)}
        onSignIn={(n) => {
          setName(n);
          setOpen(false);
        }}
        signUpBlurb="Join Atlas for early access to new drops."
        signInBlurb="Welcome back. Sign in to see your orders."
      />
    </StoreScope>
  );
}