File tree Expand file tree Collapse file tree 6 files changed +113
-3
lines changed Expand file tree Collapse file tree 6 files changed +113
-3
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " aaronczichon.de" ,
3
3
"type" : " module" ,
4
- "version" : " 1.0.0 " ,
4
+ "version" : " 1.0.1 " ,
5
5
"description" : " Personal website of Aaron Czichon" ,
6
6
"scripts" : {
7
7
"dev" : " astro dev" ,
28
28
"typescript" : " ^5.3.3"
29
29
},
30
30
"devDependencies" : {
31
+ "@types/mapbox-gl" : " ^3.1.0" ,
31
32
"prettier" : " ^3.2.5" ,
32
33
"prettier-plugin-astro" : " ^0.13.0"
33
34
}
Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ import { Image } from "astro:assets";
31
31
class={currentPath.indexOf("cv") > -1 ? "active" : ""}>CV</a
32
32
> -->
33
33
<a href =" /cv/" class ={ currentPath .indexOf (" cv" ) > - 1 ? " active" : " " } >CV</a >
34
+ <a
35
+ href =" /visited-countries/"
36
+ class ={ currentPath .indexOf (" visited-countries" ) > - 1 ? " active" : " " }
37
+ >Visited Countries</a
38
+ >
34
39
<!-- <a
35
40
href="/pengiun"
36
41
class={currentPath.indexOf("pengiun") > -1 ? "active" : ""}
Original file line number Diff line number Diff line change
1
+ import { useState , useEffect } from 'preact/hooks' ;
2
+
3
+ import BasicMap from './BasicMap' ;
4
+ import { addMapLayer } from './map.func' ;
5
+
6
+ export default function CountryDynamicMap ( { zoom, center} ) {
7
+ const [ map , setMap ] = useState ( null ) ;
8
+ useEffect ( ( ) => {
9
+ // Add route to map
10
+ if ( map ) {
11
+ map . on ( 'load' , ( ) => {
12
+ addMapLayer ( map ) ;
13
+ } ) ;
14
+ }
15
+ } , [ map ] ) ;
16
+
17
+ useEffect ( ( ) => {
18
+ if ( map ) {
19
+ map . setCenter ( center ) ;
20
+ }
21
+ } )
22
+
23
+ return (
24
+ < BasicMap zoom = { zoom } setMap = { setMap } />
25
+ ) ;
26
+ }
Original file line number Diff line number Diff line change
1
+ import * as mapboxgl from 'mapbox-gl' ;
2
+
3
+ export const addMapLayer = ( map : mapboxgl . Map ) => {
4
+ map . addSource ( 'countries' , {
5
+ type : 'vector' ,
6
+ url : 'mapbox://mapbox.country-boundaries-v1'
7
+ } ) ;
8
+
9
+ map . addLayer (
10
+ {
11
+ id : 'country-boundaries' ,
12
+ source : 'countries' ,
13
+ 'source-layer' : 'country_boundaries' ,
14
+ type : 'fill' ,
15
+ paint : {
16
+ 'fill-color' : '#19bf32' ,
17
+ 'fill-opacity' : 0.7 ,
18
+ } ,
19
+ } ,
20
+ 'country-label'
21
+ ) ;
22
+
23
+ // ISO List: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
24
+ map . setFilter ( 'country-boundaries' , [
25
+ "in" ,
26
+ "iso_3166_1_alpha_3" ,
27
+ 'ITA' ,
28
+ 'CAN' ,
29
+ 'DEU' ,
30
+ 'ESP' ,
31
+ 'SVK' ,
32
+ 'SVN' ,
33
+ 'CZE' ,
34
+ 'HRV' ,
35
+ 'BEL' ,
36
+ 'NOR' ,
37
+ 'AUT' ,
38
+ 'LTU' ,
39
+ 'FIN' ,
40
+ 'EST' ,
41
+ 'USA' ,
42
+ 'CHE' ,
43
+ 'FRA'
44
+ ] ) ;
45
+ }
Original file line number Diff line number Diff line change
1
+ ---
2
+ import Layout from " ../layouts/Layout.astro" ;
3
+ import CountryMap from " ../components/dynamic/CountryMap" ;
4
+ ---
5
+
6
+ <Layout title =" Aaron Czichon - Visited Countries" >
7
+ <main class =" container" >
8
+ <h1 >Visited Countries</h1 >
9
+ <p >
10
+ I've already visited a bunch of countries in my life. I love to keep track
11
+ of such things.
12
+ </p >
13
+ </main >
14
+
15
+ <!-- Map Component here -->
16
+ <CountryMap client:visible zoom =" 3" center ={ [10.451526 , 51.165691 ]} />
17
+ </Layout >
You can’t perform that action at this time.
0 commit comments