install and handle casle & prevent page dashboard & handle register and code verfication & get data in clinics page
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { useState } from "react";
|
||||
|
||||
import List from "./list";
|
||||
import { searchOnList } from "@/helper";
|
||||
import SearchBar from "./head/SearchBar";
|
||||
import clinics from "@/data/clinics.json";
|
||||
import HeadPageList from "@/app/component/head";
|
||||
|
||||
function ClinicsPage({ matchedCity, matchedState }) {
|
||||
const [loading, setLoading] = useState(true);
|
||||
function ClinicsPage({ clinics, matchedCity, matchedState }) {
|
||||
const [filteredClinics, setFilteredClinics] = useState(clinics);
|
||||
|
||||
const [selected, setSelected] = useState({
|
||||
@@ -17,12 +15,6 @@ function ClinicsPage({ matchedCity, matchedState }) {
|
||||
city: matchedCity?.name || "",
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
setTimeout(() => {
|
||||
setLoading(false);
|
||||
}, 2000);
|
||||
}, []);
|
||||
|
||||
const handleSearch = (value) => {
|
||||
const searchOnName = searchOnList(clinics, value, "title");
|
||||
const searchOnLocation = searchOnList(searchOnName, selected.city, "city");
|
||||
@@ -42,7 +34,7 @@ function ClinicsPage({ matchedCity, matchedState }) {
|
||||
handleSearch={handleSearch}
|
||||
/>
|
||||
</HeadPageList>
|
||||
<List loading={loading} selected={selected} clinics={filteredClinics} />
|
||||
<List selected={selected} clinics={filteredClinics} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user