Skip to content

Commit 1614d27

Browse files
committed
chore: staged changes
1 parent 5adf5c3 commit 1614d27

File tree

11 files changed

+121
-27
lines changed

11 files changed

+121
-27
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"@fontsource-variable/noto-sans-thai": "^5.0.14",
1919
"@fontsource/k2d": "^5.0.19",
2020
"@neodrag/svelte": "^2.0.6",
21+
"@types/apple-mapkit-js-browser": "^5.65.7",
2122
"astro": "^4.6.1",
2223
"prettier": "^3.2.5",
2324
"prettier-plugin-astro": "^0.13.0",

pnpm-lock.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/packlets/front/map.astro

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<div id="map" class="h-80"></div>
2+
3+
<script>
4+
window.addEventListener('load', function () {
5+
mapkit.init({
6+
authorizationCallback: done => {
7+
fetch('https://api.rayriffy.com/appleMaps/token')
8+
.then(res => res.text())
9+
.then(done)
10+
},
11+
language: 'en',
12+
})
13+
14+
const map = new mapkit.Map('map')
15+
const coordinate = new mapkit.Coordinate(13.6869421, 100.6112208)
16+
const region = new mapkit.CoordinateRegion(
17+
coordinate,
18+
new mapkit.CoordinateSpan(0.1, 0.11)
19+
)
20+
21+
map.cameraZoomRange = new mapkit.CameraZoomRange(500, 75000)
22+
map.cameraBoundary = region
23+
map.region = region
24+
25+
map.showItems([
26+
new mapkit.MarkerAnnotation(coordinate, {
27+
title: 'True Digital Park West',
28+
subtitle: 'Grand Hall, 3rd Fl.',
29+
}),
30+
])
31+
})
32+
</script>
33+
34+
<script
35+
src="https://cdn.apple-mapkit.com/mk/5.x.x/mapkit.core.js"
36+
crossorigin
37+
async
38+
data-libraries="services,full-map"
39+
slot="body-end"></script>

src/packlets/front/schedule.astro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<section class="bg-เหล็กไหล py-12 text-white">
2+
<h1 class="text-center text-4xl font-bold">Schedule</h1>
3+
</section>

src/packlets/layouts/base.astro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
import '@fontsource/k2d'
33
import '@fontsource-variable/noto-sans-thai'
4+
import Footer from './footer.astro'
45
56
interface Props {
67
title: string
@@ -21,6 +22,8 @@ const { title } = Astro.props
2122
</head>
2223
<body class="antialiased">
2324
<slot />
25+
<Footer />
26+
<slot name="body-end" />
2427
</body>
2528
</html>
2629

src/packlets/layouts/footer.astro

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<footer
2+
class="flex h-40 items-end justify-between bg-นิลกาฬ p-4 text-white lg:p-8 lg:text-lg"
3+
>
4+
<div>Crafted by 👩‍💻 🧑‍🎨 🧙 🦹‍♀️ & more.</div>
5+
<a
6+
href="https://creatorsgarten.org"
7+
target="_blank"
8+
rel="noopener noreferrer"
9+
aria-label="Creatorsgarten"
10+
>
11+
<img
12+
src="https://creatorsgarten.org/images/creatorsgarten.svg"
13+
alt=""
14+
loading="lazy"
15+
class="h-8 lg:h-12"
16+
style="filter: invert(1);"
17+
/>
18+
</a>
19+
</footer>

src/packlets/front/balloon.svelte renamed to src/packlets/playground/balloon.svelte

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,27 @@
3232
(vertical ? vertical - size / 2 : -size) + window.innerHeight / 2
3333
let mountedAt = performance.now()
3434
35-
const frame = () => {
36-
if (ended) return
37-
38-
const time = (performance.now() - mountedAt) / 1000
39-
const distance = 0.5 * acceleration * time ** 2
35+
onMount(() => {
36+
let frame = requestAnimationFrame(function loop() {
37+
if (ended) return
4038
41-
// calculate new height based on initial height and distance, would fly up
42-
currentHeight = currentHeight + distance
39+
const time = (performance.now() - mountedAt) / 1000
40+
const distance = 0.5 * acceleration * time ** 2
4341
44-
// stop when it overshoots viewport height
45-
if (-currentHeight - size * 2 > window.innerHeight) {
46-
ended = true
47-
}
42+
// calculate new height based on initial height and distance, would fly up
43+
currentHeight = currentHeight + distance
4844
49-
requestAnimationFrame(frame)
50-
}
45+
// stop when it overshoots viewport height
46+
if (-currentHeight - size * 2 > window.innerHeight) {
47+
ended = true
48+
}
5149
52-
onMount(() => {
53-
requestAnimationFrame(frame)
50+
frame = requestAnimationFrame(loop)
51+
})
5452
5553
return () => {
5654
ended = true
55+
cancelAnimationFrame(frame)
5756
}
5857
})
5958
File renamed without changes.

src/packlets/front/playground.svelte renamed to src/packlets/playground/playground.svelte

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import type { MouseEventHandler } from 'svelte/elements'
33
44
import Balloon from './balloon.svelte'
5+
import { onMount } from 'svelte'
56
67
interface Item {
78
id: string
@@ -12,22 +13,38 @@
1213
1314
let balloons: Item[] = []
1415
15-
const handleEnd = (event: CustomEvent<string>) => {
16-
balloons = balloons.filter(balloon => balloon.id !== event.detail)
17-
}
18-
19-
const handleClick: MouseEventHandler<HTMLElement> = e => {
20-
const size = Math.floor(Math.random() * 200) + 60
16+
const addBalloon = (x: number, y = 0) => {
17+
const size = Math.floor(Math.random() * 300300) + 60
2118
2219
const item: Item = {
2320
id: (Math.random() + 1).toString(36).substring(7),
2421
size,
25-
horizontal: e.pageX - size / 2,
26-
vertical: -window.outerHeight + e.pageY + size,
22+
horizontal: x - size / 2,
23+
vertical: y + size,
2724
}
2825
2926
balloons = [...balloons, item]
3027
}
28+
29+
const handleEnd = (event: CustomEvent<string>) => {
30+
balloons = balloons.filter(balloon => balloon.id !== event.detail)
31+
}
32+
33+
const handleClick: MouseEventHandler<HTMLElement> = e => {
34+
addBalloon(e.pageX, -window.outerHeight + e.pageY)
35+
}
36+
37+
onMount(() => {
38+
// randomly generate balloons
39+
const interval = setInterval(() => {
40+
addBalloon(Math.floor(Math.random() * window.outerWidth))
41+
addBalloon(Math.floor(Math.random() * window.outerWidth))
42+
addBalloon(Math.floor(Math.random() * window.outerWidth))
43+
addBalloon(Math.floor(Math.random() * window.outerWidth))
44+
}, 600)
45+
46+
return () => clearInterval(interval)
47+
})
3148
</script>
3249

3350
<section

0 commit comments

Comments
 (0)