mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-23 01:36:55 +08:00
chore: perfect type definition (#1003)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
'use client'
|
||||
import type { FC } from 'react'
|
||||
import type { SVGProps } from 'react'
|
||||
import React, { useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import s from './style.module.css'
|
||||
@@ -8,7 +8,7 @@ type InputProps = {
|
||||
placeholder?: string
|
||||
value?: string
|
||||
defaultValue?: string
|
||||
onChange?: (v: any) => void
|
||||
onChange?: (v: string) => void
|
||||
className?: string
|
||||
wrapperClassName?: string
|
||||
type?: string
|
||||
@@ -16,13 +16,13 @@ type InputProps = {
|
||||
prefixIcon?: React.ReactNode
|
||||
}
|
||||
|
||||
const GlassIcon: FC<{ className?: string }> = ({ className }) => (
|
||||
const GlassIcon = ({ className }: SVGProps<SVGElement>) => (
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg" className={className ?? ''}>
|
||||
<path d="M12.25 12.25L10.2084 10.2083M11.6667 6.70833C11.6667 9.44675 9.44675 11.6667 6.70833 11.6667C3.96992 11.6667 1.75 9.44675 1.75 6.70833C1.75 3.96992 3.96992 1.75 6.70833 1.75C9.44675 1.75 11.6667 3.96992 11.6667 6.70833Z" stroke="#344054" strokeWidth="1.25" strokeLinecap="round" strokeLinejoin="round" />
|
||||
</svg>
|
||||
)
|
||||
|
||||
const Input: FC<InputProps> = ({ value, defaultValue, onChange, className = '', wrapperClassName = '', placeholder, type, showPrefix, prefixIcon }) => {
|
||||
const Input = ({ value, defaultValue, onChange, className = '', wrapperClassName = '', placeholder, type, showPrefix, prefixIcon }: InputProps) => {
|
||||
const [localValue, setLocalValue] = useState(value ?? defaultValue)
|
||||
const { t } = useTranslation()
|
||||
return (
|
||||
@@ -31,7 +31,7 @@ const Input: FC<InputProps> = ({ value, defaultValue, onChange, className = '',
|
||||
<input
|
||||
type={type ?? 'text'}
|
||||
className={`${s.input} ${showPrefix ? '!pl-7' : ''} ${className}`}
|
||||
placeholder={placeholder ?? (showPrefix ? t('common.operation.search') : 'please input')}
|
||||
placeholder={placeholder ?? (showPrefix ? t('common.operation.search') ?? '' : 'please input')}
|
||||
value={localValue}
|
||||
onChange={(e) => {
|
||||
setLocalValue(e.target.value)
|
||||
|
||||
Reference in New Issue
Block a user