diff --git a/index.html b/index.html
index e4e127d..60ceabd 100644
--- a/index.html
+++ b/index.html
@@ -4,11 +4,17 @@
+
Frontend Mentor | IP Address Tracker
-
+
@@ -39,7 +45,7 @@
-
IP address
@@ -67,7 +73,9 @@
-
+
+
+
diff --git a/package-lock.json b/package-lock.json
index 698a9e6..678373a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,9 +8,11 @@
"name": "fem-ip-address-tracker",
"version": "0.0.0",
"dependencies": {
- "@netlify/functions": "^2.6.0"
+ "@netlify/functions": "^2.6.0",
+ "leaflet": "^1.9.4"
},
"devDependencies": {
+ "@types/leaflet": "^1.9.8",
"autoprefixer": "^10.4.19",
"postcss": "^8.4.38",
"prettier": "^3.2.5",
@@ -716,6 +718,21 @@
"integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==",
"dev": true
},
+ "node_modules/@types/geojson": {
+ "version": "7946.0.14",
+ "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.14.tgz",
+ "integrity": "sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==",
+ "dev": true
+ },
+ "node_modules/@types/leaflet": {
+ "version": "1.9.8",
+ "resolved": "https://registry.npmjs.org/@types/leaflet/-/leaflet-1.9.8.tgz",
+ "integrity": "sha512-EXdsL4EhoUtGm2GC2ZYtXn+Fzc6pluVgagvo2VC1RHWToLGlTRwVYoDpqS/7QXa01rmDyBjJk3Catpf60VMkwg==",
+ "dev": true,
+ "dependencies": {
+ "@types/geojson": "*"
+ }
+ },
"node_modules/@types/node": {
"version": "20.11.30",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.30.tgz",
@@ -1322,6 +1339,11 @@
"jiti": "bin/jiti.js"
}
},
+ "node_modules/leaflet": {
+ "version": "1.9.4",
+ "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.9.4.tgz",
+ "integrity": "sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA=="
+ },
"node_modules/lilconfig": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz",
diff --git a/package.json b/package.json
index ddafb4c..3e7265c 100644
--- a/package.json
+++ b/package.json
@@ -9,6 +9,7 @@
"preview": "vite preview"
},
"devDependencies": {
+ "@types/leaflet": "^1.9.8",
"autoprefixer": "^10.4.19",
"postcss": "^8.4.38",
"prettier": "^3.2.5",
@@ -18,6 +19,7 @@
"vite": "^5.2.0"
},
"dependencies": {
- "@netlify/functions": "^2.6.0"
+ "@netlify/functions": "^2.6.0",
+ "leaflet": "^1.9.4"
}
}
diff --git a/src/main.ts b/src/main.ts
index 3b4d39e..383aaba 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -1,3 +1,5 @@
+import L from "leaflet";
+
type LocationDataError = { code: number; messages: string };
type LocationData = {
ip: number;
@@ -13,6 +15,17 @@ type LocationData = {
type LocationDataResponse = LocationDataError | LocationData;
const searchForm = document.querySelector("#js-search");
+const map = L.map("map", { zoomControl: false }).setView([51.505, -0.09], 13);
+L.control
+ .zoom({
+ position: "bottomleft",
+ })
+ .addTo(map);
+L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
+ maxZoom: 19,
+ attribution:
+ '© OpenStreetMap',
+}).addTo(map);
const pIp = document.querySelector("#js-ip")!;
const pLocation = document.querySelector("#js-location")!;