feat: Refactor App component to integrate LandingPage and ProjectShowcase with search functionality
This commit is contained in:
parent
d88874b550
commit
c312d4b270
1 changed files with 17 additions and 8 deletions
15
src/App.tsx
15
src/App.tsx
|
|
@ -1,18 +1,27 @@
|
|||
|
||||
import './App.css'
|
||||
import { useState } from 'react';
|
||||
import OpenLayerMap from './components/OpenLayerMap';
|
||||
import OpenLayerEsri from './components/OpenLayerEsri';
|
||||
import LegiScanAPI from './components/LegiScanAPI';
|
||||
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
|
||||
import LandingPage from './components/LandingPage';
|
||||
import ProjectShowcase from './components/Projectpage';
|
||||
|
||||
function App() {
|
||||
const [addressData, setAddressData] = useState<any>(null);
|
||||
const [searchTerm, setSearchTerm] = useState<string>('');
|
||||
|
||||
const handleSearchSuccess = (data: any, term: string) => {
|
||||
setAddressData(data);
|
||||
setSearchTerm(term);
|
||||
};
|
||||
|
||||
return (
|
||||
<Router>
|
||||
<Routes>
|
||||
<Route path="/" element={<OpenLayerMap />} />
|
||||
<Route path="/open" element={<OpenLayerMap />} />
|
||||
<Route path="/" element={<ProjectShowcase />} />
|
||||
<Route path="/site" element={<LandingPage onSearchSuccess={handleSearchSuccess} />} />
|
||||
<Route path="/open" element={<OpenLayerMap initialAddressData={addressData} initialTerm={searchTerm} />} />
|
||||
<Route path="/esri" element={<OpenLayerEsri />} />
|
||||
<Route path="/legi" element={<LegiScanAPI />} />
|
||||
</Routes>
|
||||
|
|
|
|||
Loading…
Reference in a new issue