-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app): Add Pop Culture references interaction using Preact
Implementing Astro Islands concept!
- Loading branch information
Showing
6 changed files
with
328 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
import { defineConfig } from 'astro/config'; | ||
|
||
import preact from "@astrojs/preact"; | ||
|
||
// https://astro.build/config | ||
export default defineConfig({ | ||
site: "https://djsiddz.github.io", | ||
base: "/space-ahead" | ||
}); | ||
base: "/space-ahead", | ||
integrations: [preact()] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { useState } from "preact/hooks"; | ||
|
||
export default function SpaceEmoji({emojis}) { | ||
const getRandomEmoji = () => emojis[(Math.floor(Math.random() * emojis.length))]; | ||
const [emoji, setEmoji] = useState(getRandomEmoji()); | ||
|
||
return <button class="kanit-regular text-balance" title="Click Me!" style={{fontSize: "1rem", background: "transparent", border: "none", cursor: "pointer", color: "whitesmoke", marginBottom: 0}} onClick={() => setEmoji(getRandomEmoji())}>{emoji}</button>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,27 @@ | ||
--- | ||
import SpaceEmoji from "../components/SpaceEmoji"; | ||
import MainLayout from "../layouts/MainLayout.astro"; | ||
const emojis = [ | ||
"π To Infinity, And Beyond!", | ||
"π In a galaxy far far away...", | ||
"β May the force be with you!", | ||
"βοΈ Game Over", | ||
"βοΈ βTime is an illusion. Lunchtime doubly so.β β Douglas Adams, H2G2", | ||
"π The Eagle has landed!", | ||
"π°οΈ 42", | ||
"π€ Wall-E", | ||
"π½ E.T. Phone Home", | ||
"π We'll be Counting Stars", | ||
"πΎ Press Start", | ||
"π Powered by Astro & Preact", | ||
"π Live long and prosper!", | ||
]; | ||
--- | ||
|
||
<MainLayout pageTitle="Space Ahead - An Astro Blog"> | ||
<h1 class="honk-ff balance-text">Space Ahead <span class="blinking">!</span></h1> | ||
<h1 class="honk-ff balance-text"> | ||
Space Ahead <span class="blinking">!</span> | ||
</h1> | ||
<SpaceEmoji client:load emojis={emojis} /> | ||
</MainLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
{ | ||
"extends": "astro/tsconfigs/base" | ||
} | ||
"extends": "astro/tsconfigs/base", | ||
"compilerOptions": { | ||
"jsx": "react-jsx", | ||
"jsxImportSource": "preact" | ||
} | ||
} |
Oops, something went wrong.