diff --git a/src/components/layouts/header/SearchBar.tsx b/src/components/layouts/header/SearchBar.tsx index 2f6e01ee..4e6346d4 100644 --- a/src/components/layouts/header/SearchBar.tsx +++ b/src/components/layouts/header/SearchBar.tsx @@ -1,7 +1,8 @@ import SearchIcon from "@mui/icons-material/Search"; -import { IconButton, InputBase, Paper } from "@mui/material"; +import { IconButton, InputBase, Paper, useMediaQuery } from "@mui/material"; import { styled } from "@mui/system"; import React, { useState } from "react"; +import { useTranslation } from "react-i18next"; interface SearchBarProps { onSearch: (keyword: string) => void; @@ -12,8 +13,12 @@ const SearchBox = styled(Paper)(({ theme }) => ({ padding: "2px 4px", display: "flex", alignItems: "center", - width: 400, + width: "100%", + maxWidth: 400, borderRadius: "8px", + [theme.breakpoints.down("sm")]: { + maxWidth: "100%", + }, })); const StyledInputBase = styled(InputBase)(({ theme }) => ({ @@ -23,6 +28,10 @@ const StyledInputBase = styled(InputBase)(({ theme }) => ({ const SearchBar: React.FC = ({ onSearch, placeholder }) => { const [keyword, setKeyword] = useState(""); + const { t } = useTranslation(); + const isSmallScreen = useMediaQuery((theme: any) => + theme.breakpoints.down("sm") + ); const handleInputChange = (event: React.ChangeEvent) => { if (event.target.value === "") { @@ -44,7 +53,7 @@ const SearchBar: React.FC = ({ onSearch, placeholder }) => { return ( { - + {t("MASTER.STATE")}