Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cafac07

Browse files
committed
add BgMap to Homescreen
1 parent d8aceef commit cafac07

File tree

14 files changed

+27870
-9
lines changed

14 files changed

+27870
-9
lines changed

app/components/BackgroundMap.jsx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"use client";
2+
import * as topojson from "topojson-client";
3+
import { geoPath, geoNaturalEarth1 } from "d3";
4+
import WorldAtlasTopo from "../data/world-atlas.topo.json";
5+
import WorldAtlasLand from "../data/world-atlas-land.geo.json";
6+
import WorldAtlasCountries from "../data/world-atlas-countries.geo.json";
7+
8+
export const BackgroundMap = () => {
9+
const projection = geoNaturalEarth1();
10+
const d3Path = geoPath(projection);
11+
const { features } = topojson.feature(
12+
WorldAtlasTopo,
13+
WorldAtlasTopo.objects.countries
14+
);
15+
16+
console.log(features);
17+
18+
return (
19+
<div className='bg-neutral-700'>
20+
<svg viewBox='-5 -15 975 540' xmlns='http://www.w3.org/2000/svg'>
21+
<g>
22+
{features &&
23+
features.map(({ id, geometry }) => (
24+
<path
25+
key={id}
26+
d={d3Path(geometry)}
27+
stroke='black'
28+
fill='none'
29+
className='hover:fill-red-500'
30+
/>
31+
))}
32+
</g>
33+
{/* <path d={d3Path(features)} stroke='black' fill='grey' /> */}
34+
</svg>
35+
</div>
36+
);
37+
};
File renamed without changes.
File renamed without changes.
File renamed without changes.

app/components/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export * from "./BackgroundMap";
12
export * from "./Footer";
23
export * from "./Header";
34
export * from "./SavageLogo";

0 commit comments

Comments
 (0)