diff --git a/client/src/components/homeSection/Hero/Hero.tsx b/client/src/components/homeSection/Hero/Hero.tsx index d7abffe..1863dcc 100644 --- a/client/src/components/homeSection/Hero/Hero.tsx +++ b/client/src/components/homeSection/Hero/Hero.tsx @@ -3,10 +3,11 @@ import { Button } from "../../ui/button/Button"; import { useState } from "react"; import { useNavigate } from "react-router-dom"; import { TextField } from "../../ui/textField/TextField.tsx"; +import { useMediaQuery } from "../../../hooks/useMediaQuery.tsx"; export const Hero = () => { const navigate = useNavigate(); - + const isMobile = useMediaQuery("(max-width: 640px)"); const [subject, setSubject] = useState("english"); const onSearch = () => { @@ -40,8 +41,10 @@ export const Hero = () => {
diff --git a/client/src/components/ui/textField/TextField.tsx b/client/src/components/ui/textField/TextField.tsx index a98928b..de2c3e0 100644 --- a/client/src/components/ui/textField/TextField.tsx +++ b/client/src/components/ui/textField/TextField.tsx @@ -97,7 +97,7 @@ const inputStyles = cva( primary: "text-light-100 placeholder:text-dark-400", secondary: "text-light-500 placeholder:text-light-500", primarySmall: "text-light-100 placeholder:text-dark-400", - hero: "text-light-500 placeholder:text-light-500", + hero: "text-light-500 placeholder:text-light-500 placeholder:text-xs", }, state: { default: "", diff --git a/client/src/hooks/useMediaQuery.tsx b/client/src/hooks/useMediaQuery.tsx new file mode 100644 index 0000000..bed9e90 --- /dev/null +++ b/client/src/hooks/useMediaQuery.tsx @@ -0,0 +1,15 @@ +import { useEffect, useState } from "react"; + +export function useMediaQuery(query: string) { + const [matches, setMatches] = useState(false); + + useEffect(() => { + const m = window.matchMedia(query); + const onChange = () => setMatches(m.matches); + onChange(); + m.addEventListener("change", onChange); + return () => m.removeEventListener("change", onChange); + }, [query]); + + return matches; +}