'style3
This commit is contained in:
26
app/components/CitySelect.tsx
Normal file
26
app/components/CitySelect.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
"use client";
|
||||
|
||||
import { CITIES } from "@/config/home.config";
|
||||
|
||||
interface CitySelectProps {
|
||||
value: string;
|
||||
onChange: (v: string) => void;
|
||||
className?: string;
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
export default function CitySelect({ value, onChange, className = "", required }: CitySelectProps) {
|
||||
return (
|
||||
<select
|
||||
value={value}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
required={required}
|
||||
className={`form-input appearance-none ${value ? "text-stone-800 dark:text-stone-100" : "text-stone-400 dark:text-stone-500"} ${className}`}
|
||||
>
|
||||
<option value="" disabled>请选择城市</option>
|
||||
{CITIES.map((c) => (
|
||||
<option key={c} value={c}>{c}</option>
|
||||
))}
|
||||
</select>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user