From 48b4e756ddc4ce4795e7dc3181e4e635a4dbbfef Mon Sep 17 00:00:00 2001 From: Eric Robsky Huntley Date: Tue, 27 Feb 2024 09:53:25 -0500 Subject: [PATCH] more typing --- src/components/Globe.astro | 7 ++++--- src/components/Header.astro | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/Globe.astro b/src/components/Globe.astro index 1b8b715..f0edbc5 100644 --- a/src/components/Globe.astro +++ b/src/components/Globe.astro @@ -31,6 +31,7 @@ const { lng, lat, zoom, mapstyle, bearing, accesstoken, interactive = false, sec constructor() { super() let dest = [-80, 42] + let sec = Number(this.dataset.sec); mapboxgl.accessToken = this.dataset.accesstoken const map = new mapboxgl.Map({ container: 'map', @@ -42,7 +43,7 @@ const { lng, lat, zoom, mapstyle, bearing, accesstoken, interactive = false, sec style: this.dataset.mapstyle }) - if(this.dataset.sec > 0) { + if(sec > 0) { function spinGlobe(sec: number) { let distancePerSecond = 360 / sec; let cnt = map.getCenter(); @@ -50,9 +51,9 @@ const { lng, lat, zoom, mapstyle, bearing, accesstoken, interactive = false, sec map.easeTo({ cnt, duration: 1000, easing: (n) => n }); } map.on('moveend', () => { - spinGlobe(this.dataset.sec); + spinGlobe(sec); }); - spinGlobe(this.dataset.sec); + spinGlobe(sec); } } } diff --git a/src/components/Header.astro b/src/components/Header.astro index 6367338..4142ebc 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -2,7 +2,10 @@ import Navbar from '@components/Navbar.astro'; interface Props { - navItems: object[]; + navItems: [{ + path: string; + title: string; + }]; } const {navItems} = Astro.props;