From e030b6edfd3193733148126f92dc5873acd6ff50 Mon Sep 17 00:00:00 2001 From: rahul_g Date: Mon, 22 Jul 2024 12:20:05 +0530 Subject: [PATCH 1/3] fixed label issue on block component --- src/pages/block.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/pages/block.tsx b/src/pages/block.tsx index 4165b65b..a66ff0e8 100644 --- a/src/pages/block.tsx +++ b/src/pages/block.tsx @@ -145,7 +145,12 @@ const Block: React.FC = () => { - States + + States + Date: Mon, 22 Jul 2024 14:39:19 +0530 Subject: [PATCH 2/3] added responsiveness to the master --- src/pages/block.tsx | 24 +++++++++++++++++++----- src/pages/district.tsx | 20 +++++++++++++++----- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/pages/block.tsx b/src/pages/block.tsx index a66ff0e8..92e38786 100644 --- a/src/pages/block.tsx +++ b/src/pages/block.tsx @@ -11,6 +11,7 @@ import MenuItem from "@mui/material/MenuItem"; import Select, { SelectChangeEvent } from "@mui/material/Select"; import PageSizeSelector from "@/components/PageSelector"; import { useTranslation } from "next-i18next"; +import { useMediaQuery } from "@mui/material"; // Static Data const staticStateData = [ @@ -38,6 +39,8 @@ const Block: React.FC = () => { const [pageSize, setPageSize] = useState(10); const [sortDirection, setSortDirection] = useState<"asc" | "desc">("asc"); const [selectedFilter, setSelectedFilter] = useState("All"); + const isMobile = useMediaQuery("(max-width:600px)"); + const isMediumScreen = useMediaQuery("(max-width:986px)"); const columns = useMemo( () => [ @@ -142,9 +145,20 @@ const Block: React.FC = () => { return ( - - - + + + { - - + + { setSelectedState(selectedState); try { const data = await getDistrictList(selectedState); - setDistrictData(data.result || []); + setDistrictData(data.result || []); setSelectedDistrict(data.result[0]?.label || "-"); } catch (error) { console.error("Error fetching district data", error); @@ -118,11 +118,11 @@ const District: React.FC = () => { const fetchStateData = async () => { try { const data = await getStateList(); - setStateData(data.result || []); + setStateData(data.result || []); const initialSelectedState = data.result[0]?.value || ""; setSelectedState(initialSelectedState); const districtData = await getDistrictList(initialSelectedState); - setDistrictData(districtData.result || []); + setDistrictData(districtData.result || []); setSelectedDistrict(districtData.result[0]?.label || "-"); } catch (error) { console.error("Error fetching state data", error); @@ -168,8 +168,18 @@ const District: React.FC = () => { return ( - - + + States