edit city search

This commit is contained in:
madarsbiss 2021-08-03 13:31:25 +03:00
parent cd2af9eb5b
commit b33a6ac6b2

View File

@ -3,7 +3,7 @@ import styles from "../styles/Home.module.css";
import Image from "next/image"; import Image from "next/image";
export default function Home() { export default function Home() {
const [input, setInput] = useState("mumbai"); const [input, setInput] = useState("Riga");
const [systemUsed, setSystemUsed] = useState("metric"); const [systemUsed, setSystemUsed] = useState("metric");
const [weatherData, setWeatherData] = useState(); const [weatherData, setWeatherData] = useState();
@ -157,10 +157,17 @@ export default function Home() {
<input <input
type="text" type="text"
className={styles.searchInput} className={styles.searchInput}
defaultValue="Search..." placeholder="Search a city..."
onFocus={(e) => (e.target.value = "")} value={input}
onFocus={(e) => {
e.target.value = "";
e.target.placeholder = "";
}}
onChange={(e) => setInput(e.target.value)} onChange={(e) => setInput(e.target.value)}
onKeyDown={(e) => enterKeydown(e)} onKeyDown={(e) => {
enterKeydown(e);
e.target.placeholder = "Search a city...";
}}
/> />
</div> </div>