From cec45e8f174cb3b9f45f1431ee15fac2fdba5e90 Mon Sep 17 00:00:00 2001 From: Kawa Date: Fri, 27 Mar 2026 09:29:08 +0100 Subject: [PATCH] feat(03-02): create BackendCard and PasswordField UI atoms - BackendCard: clickable selection card with selected/unselected visual states - PasswordField: password input with per-instance show/hide toggle (text labels, no emoji) - Both files in new src/components/ui/ directory --- src/components/ui/BackendCard.tsx | 28 ++++++++++++++++++ src/components/ui/PasswordField.tsx | 44 +++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 src/components/ui/BackendCard.tsx create mode 100644 src/components/ui/PasswordField.tsx diff --git a/src/components/ui/BackendCard.tsx b/src/components/ui/BackendCard.tsx new file mode 100644 index 0000000..7b80dd2 --- /dev/null +++ b/src/components/ui/BackendCard.tsx @@ -0,0 +1,28 @@ +import type { ButtonHTMLAttributes } from 'react'; + +interface BackendCardProps extends Omit, 'onClick'> { + name: string; + description: string; + selected?: boolean; + onClick: () => void; +} + +export function BackendCard({ name, description, selected = false, onClick, ...rest }: BackendCardProps) { + return ( + + ); +} diff --git a/src/components/ui/PasswordField.tsx b/src/components/ui/PasswordField.tsx new file mode 100644 index 0000000..3befc7f --- /dev/null +++ b/src/components/ui/PasswordField.tsx @@ -0,0 +1,44 @@ +import { useState } from 'react'; +import type { FieldError, UseFormRegisterReturn } from 'react-hook-form'; + +interface PasswordFieldProps { + id: string; + label: string; + error?: FieldError; + registration: UseFormRegisterReturn; + placeholder?: string; + helpText?: string; +} + +export function PasswordField({ id, label, error, registration, placeholder, helpText }: PasswordFieldProps) { + const [show, setShow] = useState(false); + return ( +
+ +
+ + +
+ {helpText && !error &&

{helpText}

} + {error &&

{error.message}

} +
+ ); +}