feat: support assistant frontend (#2139)

Co-authored-by: StyleZhang <jasonapring2015@outlook.com>
This commit is contained in:
Joel
2024-01-23 19:31:56 +08:00
committed by GitHub
parent e65a2a400d
commit 7bbe12b2bd
194 changed files with 8726 additions and 1586 deletions

View File

@@ -9,6 +9,9 @@ type InputProps = {
validated?: boolean
className?: string
disabled?: boolean
type?: string
min?: number
max?: number
}
const Input: FC<InputProps> = ({
value,
@@ -18,7 +21,19 @@ const Input: FC<InputProps> = ({
validated,
className,
disabled,
type = 'text',
min,
max,
}) => {
const toLimit = (v: string) => {
if (min !== undefined && parseFloat(v) < min) {
onChange(`${min}`)
return
}
if (max !== undefined && parseFloat(v) > max)
onChange(`${max}`)
}
return (
<div className='relative'>
<input
@@ -34,9 +49,13 @@ const Input: FC<InputProps> = ({
`}
placeholder={placeholder || ''}
onChange={e => onChange(e.target.value)}
onBlur={e => toLimit(e.target.value)}
onFocus={onFocus}
value={value || ''}
disabled={disabled}
type={type}
min={min}
max={max}
/>
{
validated && (