diff --git a/app/components/WeatherDetailsGird.tsx b/app/components/WeatherDetailsGird.tsx index 30bf498..d4fe5ff 100644 --- a/app/components/WeatherDetailsGird.tsx +++ b/app/components/WeatherDetailsGird.tsx @@ -1,5 +1,6 @@ import { Cloud, Droplets, Gauge, ThermometerSun, Wind } from "lucide-react"; import { useWeatherStore } from "@/store/weatherStore"; +import { MapPin, Thermometer } from "lucide-react"; interface WeatherDetailsGridProps { icon: React.ReactNode; diff --git a/app/components/WeatherDisplay.tsx b/app/components/WeatherDisplay.tsx index 465256b..bd26713 100644 --- a/app/components/WeatherDisplay.tsx +++ b/app/components/WeatherDisplay.tsx @@ -9,6 +9,7 @@ import { CloudSnow, CloudSun, MapPin, Moon, Sun, + Thermometer, ThermometerSun } from 'lucide-react'; @@ -44,7 +45,6 @@ function WeatherIcon({ description, isDay, className = "w-16 h-16 md:w-20 md:h-2 } return isDaytime ? : ; } - export function WeatherDisplay(){ const {currentWeather} = useWeatherStore(); if(!currentWeather) return null; diff --git a/app/components/WeatherSearchForm.tsx b/app/components/WeatherSearchForm.tsx index 8623d3c..ab0ac03 100644 --- a/app/components/WeatherSearchForm.tsx +++ b/app/components/WeatherSearchForm.tsx @@ -25,11 +25,7 @@ export function WeatherSearchForm() { setInputError('请输入城市名称'); return; } - if (!trimmedCity) { - setInputError('请输入有效的城市名称'); - return; - } - + if (trimmedCity.length < 2) { setInputError('请输入至少2个字符'); return; @@ -40,10 +36,9 @@ export function WeatherSearchForm() { return; } await searchWeather(trimmedCity); - } - + return ( -
+
@@ -52,16 +47,16 @@ export function WeatherSearchForm() { setCity(e.target.value)} + onChange={handleInputChange} placeholder="请输入城市名称" disabled={isLoading} - className={cn('pl-10 pr-4 py-2 w-full', 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') } />
{inputError && ( -
- -

{inputError}

+
+ +

{inputError}

@@ -99,4 +94,5 @@ export function WeatherSearchForm() { ) } +} } \ No newline at end of file