From dde2a1f01fc3d94a1aa6248e76366484beeec32d Mon Sep 17 00:00:00 2001 From: Kawa Date: Mon, 30 Mar 2026 18:14:01 +0200 Subject: [PATCH] feat(06-02): create SftpAuthToggle.tsx following AzureAuthToggle CSS-hidden pattern - Password and Private Key tabs using CSS-hidden segmented control - Both pass and key_pem fields always registered with react-hook-form - Password tab active by default (authMethod = 'password') - Active tab: bg-blue-600 text-white; inactive: bg-white text-gray-700 hover:bg-gray-50 - Wired into RemoteConfigStep in Plan 03 (06-03-PLAN.md) --- src/components/wizard/SftpAuthToggle.tsx | 69 ++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/components/wizard/SftpAuthToggle.tsx diff --git a/src/components/wizard/SftpAuthToggle.tsx b/src/components/wizard/SftpAuthToggle.tsx new file mode 100644 index 0000000..5a4fbd2 --- /dev/null +++ b/src/components/wizard/SftpAuthToggle.tsx @@ -0,0 +1,69 @@ +import { useState } from 'react'; +import type { UseFormRegister, FieldError } from 'react-hook-form'; +import { PasswordField } from '../ui/PasswordField'; + +type AuthMethod = 'password' | 'key'; + +interface SftpAuthToggleProps { + register: UseFormRegister; + errors: { + pass?: FieldError; + key_pem?: FieldError; + }; +} + +export function SftpAuthToggle({ register, errors }: SftpAuthToggleProps) { + const [authMethod, setAuthMethod] = useState('password'); + + return ( +
+ {/* Segmented control */} +
+ + +
+ + {/* Both fields always registered — only active one visible via CSS */} +
+ +
+
+ +
+
+ ); +}