Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions map/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions map/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
"axios": "^1.6.5",
"maplibre-gl": "^3.6.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
12 changes: 10 additions & 2 deletions map/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import type { FeatureCollection } from 'geojson';
import type { CircleLayer } from 'react-map-gl/maplibre';

import ControlPanel from './control-panel';
import { useState, useMemo } from 'react';
import { useState, useMemo, useEffect } from 'react';
import axios from 'axios';

const officeJson: FeatureCollection = {
"type": "FeatureCollection",
Expand Down Expand Up @@ -36,6 +37,13 @@ function App() {

const [popupInfo,setPopupInfo] = useState<izakayaObj>();
const [isShown,setIsShown] = useState<boolean>(false);
const [izakayaList, setIzakayaList] = useState<izakayaObj[]>();


const searchIzakaya = () => {
axios.get("nomerukamoapi.azurewebsites.net")
.then((response) => setIzakayaList(response.data))
}

const pins = useMemo(
() =>
Expand Down Expand Up @@ -88,7 +96,7 @@ function App() {
</Popup>
)}
</Map>
<ControlPanel />
<ControlPanel onClick={searchIzakaya}/>
</>
)
}
Expand Down
4 changes: 2 additions & 2 deletions map/src/control-panel.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react';

function ControlPanel() {
const ControlPanel = (onClick: () => void) => {
return (
<div className="control-panel">
<h3>検索</h3>
<h3 onClick={onClick}>検索</h3>
</div>
);
}
Expand Down