From ac2227fdecd916fbb78ade703750ba7cb01593d8 Mon Sep 17 00:00:00 2001 From: luciano Date: Wed, 29 Apr 2026 14:09:59 +0200 Subject: [PATCH] feat(web): adopt shadcn/ui primitives for auth surface Add shadcn/ui plumbing: - components.json (style: new-york, baseColor: slate, primary: green ~142 71%) - src/lib/utils.ts with cn() helper (clsx + tailwind-merge) - Tailwind config switched to CSS variables theming with primary/destructive/ muted/card etc. tokens, dark-mode class, tailwindcss-animate plugin - src/styles/globals.css declares :root and .dark variable palettes Initial component set under src/components/ui: - Button (cva variants: default/destructive/outline/secondary/ghost/link, asChild) - Input - Label (Radix Label) - Card + CardHeader/Title/Description/Content/Footer Refactor existing auth surface to the new primitives: - sign-in / sign-up pages wrap form in a Card with Title/Description (+ footer for sign-up disclaimer) - sign-in-form / sign-up-form use Input, Label, Button; tokens replace bespoke emerald/slate classes; divider and "Continua con Google" use the same Button - Home page CTAs become Button asChild around Link; SignOutButton uses Button - Hide-Google logic still works: enabledSocialProviders is now ReadonlyArray for ergonomic .includes() checks Co-Authored-By: Claude Opus 4.7 (1M context) --- apps/web/components.json | 21 ++++++ apps/web/package.json | 11 +++- .../src/app/[locale]/(auth)/sign-in/page.tsx | 18 ++++-- .../[locale]/(auth)/sign-in/sign-in-form.tsx | 49 +++++++------- .../src/app/[locale]/(auth)/sign-up/page.tsx | 29 +++++++-- .../[locale]/(auth)/sign-up/sign-up-form.tsx | 61 ++++++++---------- apps/web/src/app/[locale]/page.tsx | 25 +++---- apps/web/src/app/[locale]/sign-out-button.tsx | 10 +-- apps/web/src/components/ui/button.tsx | 45 +++++++++++++ apps/web/src/components/ui/card.tsx | 54 ++++++++++++++++ apps/web/src/components/ui/input.tsx | 18 ++++++ apps/web/src/components/ui/label.tsx | 19 ++++++ apps/web/src/lib/utils.ts | 6 ++ apps/web/src/styles/globals.css | 53 ++++++++++++++- apps/web/tailwind.config.ts | 49 +++++++++++++- packages/auth/src/server.ts | 6 +- pnpm-lock.yaml | Bin 217814 -> 223685 bytes 17 files changed, 374 insertions(+), 100 deletions(-) create mode 100644 apps/web/components.json create mode 100644 apps/web/src/components/ui/button.tsx create mode 100644 apps/web/src/components/ui/card.tsx create mode 100644 apps/web/src/components/ui/input.tsx create mode 100644 apps/web/src/components/ui/label.tsx create mode 100644 apps/web/src/lib/utils.ts diff --git a/apps/web/components.json b/apps/web/components.json new file mode 100644 index 0000000..1d82d92 --- /dev/null +++ b/apps/web/components.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "new-york", + "rsc": true, + "tsx": true, + "tailwind": { + "config": "tailwind.config.ts", + "css": "src/styles/globals.css", + "baseColor": "slate", + "cssVariables": true, + "prefix": "" + }, + "aliases": { + "components": "@/components", + "utils": "@/lib/utils", + "ui": "@/components/ui", + "lib": "@/lib", + "hooks": "@/hooks" + }, + "iconLibrary": "lucide" +} diff --git a/apps/web/package.json b/apps/web/package.json index f7cfb42..8b1b9f1 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -11,14 +11,23 @@ "test:e2e": "playwright test" }, "dependencies": { + "@hookform/resolvers": "^3.9.0", "@ketopath/auth": "workspace:*", "@ketopath/shared": "workspace:*", "@ketopath/ui": "workspace:*", + "@radix-ui/react-label": "^2.1.0", + "@radix-ui/react-slot": "^1.1.0", "better-auth": "^1.0.21", + "class-variance-authority": "^0.7.0", + "clsx": "^2.1.1", + "lucide-react": "^0.439.0", "next": "^14.2.5", "next-intl": "^3.17.2", "react": "^18.3.1", - "react-dom": "^18.3.1" + "react-dom": "^18.3.1", + "react-hook-form": "^7.53.0", + "tailwind-merge": "^2.5.2", + "tailwindcss-animate": "^1.0.7" }, "devDependencies": { "@ketopath/eslint-config": "workspace:*", diff --git a/apps/web/src/app/[locale]/(auth)/sign-in/page.tsx b/apps/web/src/app/[locale]/(auth)/sign-in/page.tsx index 1d18071..3d7ffa4 100644 --- a/apps/web/src/app/[locale]/(auth)/sign-in/page.tsx +++ b/apps/web/src/app/[locale]/(auth)/sign-in/page.tsx @@ -2,6 +2,8 @@ import { enabledSocialProviders } from '@ketopath/auth'; import { useTranslations } from 'next-intl'; import { setRequestLocale } from 'next-intl/server'; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; + import { SignInForm } from './sign-in-form'; export default function SignInPage({ params: { locale } }: { params: { locale: string } }) { @@ -9,12 +11,16 @@ export default function SignInPage({ params: { locale } }: { params: { locale: s const t = useTranslations('Auth.SignIn'); return ( -
-
-

{t('title')}

-

{t('subtitle')}

-
- +
+ + + {t('title')} + {t('subtitle')} + + + + +
); } diff --git a/apps/web/src/app/[locale]/(auth)/sign-in/sign-in-form.tsx b/apps/web/src/app/[locale]/(auth)/sign-in/sign-in-form.tsx index b3e42c2..b73e219 100644 --- a/apps/web/src/app/[locale]/(auth)/sign-in/sign-in-form.tsx +++ b/apps/web/src/app/[locale]/(auth)/sign-in/sign-in-form.tsx @@ -5,6 +5,9 @@ import { useRouter } from 'next/navigation'; import { useTranslations } from 'next-intl'; import { useState, type FormEvent } from 'react'; +import { Button } from '@/components/ui/button'; +import { Input } from '@/components/ui/input'; +import { Label } from '@/components/ui/label'; import { authClient } from '@/lib/auth-client'; export function SignInForm({ googleEnabled }: { googleEnabled: boolean }) { @@ -46,67 +49,59 @@ export function SignInForm({ googleEnabled }: { googleEnabled: boolean }) { return (
- -