From a0a9584a4d798c106ec17c2a9abc671ef985fe55 Mon Sep 17 00:00:00 2001 From: GW_MC <72297530+GWMCwing@users.noreply.github.com> Date: Fri, 19 Dec 2025 20:08:39 +0800 Subject: [PATCH] feat: add InfoIcon component with tooltip support and integrate into TextField --- .../app/components/Form/TextField.tsx | 8 ++- apps/frontend/app/components/info.tsx | 59 +++++++++++++++++++ apps/frontend/package.json | 1 + apps/frontend/pnpm-lock.yaml | 3 + 4 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 apps/frontend/app/components/info.tsx diff --git a/apps/frontend/app/components/Form/TextField.tsx b/apps/frontend/app/components/Form/TextField.tsx index bc25e1e..3e98ceb 100644 --- a/apps/frontend/app/components/Form/TextField.tsx +++ b/apps/frontend/app/components/Form/TextField.tsx @@ -1,6 +1,7 @@ import type { AnyFieldMeta } from '@tanstack/react-form'; import { LucideEye, LucideEyeClosed } from 'lucide-react'; import { useCallback, useId, useState } from 'react'; +import { InfoIcon, type InfoIconProps } from '../info'; export type TextFieldProps = { label?: string; @@ -8,12 +9,13 @@ export type TextFieldProps = { onChange?: (e: React.ChangeEvent) => void; labelProps?: React.LabelHTMLAttributes; labelDivProps?: React.HTMLAttributes; + infoIconProps?: InfoIconProps; } & React.InputHTMLAttributes & { type?: 'password'; showPasswordToggle?: boolean; }; -export function TextField({ label, value, onChange, labelProps, labelDivProps, showPasswordToggle, ...rest }: TextFieldProps) { +export function TextField({ label, value, onChange, labelProps, labelDivProps, showPasswordToggle, infoIconProps, ...rest }: TextFieldProps) { const id = useId(); const [isPasswordVisible, setIsPasswordVisible] = useState(false); const handlePasswordVisibilitySet = useCallback( @@ -24,11 +26,13 @@ export function TextField({ label, value, onChange, labelProps, labelDivProps, s }, [rest.type] ); + return (