This commit is contained in:
qiuchenfan 2025-11-17 19:59:04 +08:00
commit 99bbe5599c
1 changed files with 40 additions and 51 deletions

View File

@ -49,7 +49,7 @@ export function WeatherSearchForm() {
onChange={handleInputChange} onChange={handleInputChange}
placeholder="请输入城市名称" placeholder="请输入城市名称"
disabled={isLoading} disabled={isLoading}
className={cn('pl-10 pr-4 py-2 pl-15 w-full text-base rounded-xl bg-slate-50/50 focus:bg-white transition-all', inputError && 'border-red-500') } className={cn('pl-10 pr-4 py-2 w-full text-base rounded-xl bg-slate-50/50 focus:bg-white transition-all', inputError && 'border-red-500') }
/> />
</div> </div>
{inputError && ( {inputError && (
@ -57,11 +57,8 @@ export function WeatherSearchForm() {
<AlertCircle className="inline w-4 h-4 text-red-500 mt-0.5" /> <AlertCircle className="inline w-4 h-4 text-red-500 mt-0.5" />
<p className="text-red-500 text-xs">{inputError}</p> <p className="text-red-500 text-xs">{inputError}</p>
</div> </div>
) )
} }
<div className='flex gap-2'> <div className='flex gap-2'>
<Button type="submit" disabled={isLoading || !city.trim()} className="mt-4 w-full"> <Button type="submit" disabled={isLoading || !city.trim()} className="mt-4 w-full">
{isLoading ? <> {isLoading ? <>
@ -75,18 +72,10 @@ export function WeatherSearchForm() {
{currentWeather && ( {currentWeather && (
<Button type="button" variant="outline" onClick={refreshWeather} disabled={isLoading} className="mt-4 w-full" title='刷新数据'> <Button type="button" variant="outline" onClick={refreshWeather} disabled={isLoading} className="mt-4 w-full" title='刷新数据'>
<RefreshCw className={cn("w-5 h-5", isLoading && "animate-spin")} /> <RefreshCw className={cn("w-5 h-5", isLoading && "animate-spin")} />
</Button> </Button>
)} )}
</div> </div>
</form> </form>
</div> </div>
) )
} }