Skip to content

Commit

Permalink
Add Custom font to website
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanlangston committed Jan 4, 2024
1 parent 412a0c1 commit 4fff67a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
7 changes: 6 additions & 1 deletion src/asteroids-website/src/app.postcss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
@tailwind components;
@tailwind utilities;

@font-face {
font-family: "Hyperspace";
src: url("./HyperspaceBold.ttf");
}

input,
textarea,
button,
Expand All @@ -19,4 +24,4 @@ html {

* {
@apply text-yellow-light;
}
}
10 changes: 5 additions & 5 deletions src/asteroids-website/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
/>

{#if $isLoading}
<StatusContainer spin={true} emoji={true} status={get(Module.statusMessage)} />
<StatusContainer spin={true} status={get(Module.statusMessage)} />
{:else}
<div transition:fade={{ delay: 250, duration: 300 }} class="portrait:hidden">
<span in:fade={{ duration: 300 }} id="controls" class="hidden">
Expand Down Expand Up @@ -292,17 +292,17 @@
{/if}
</div>
{#key status}
<StatusContainer spin={starting} emoji={true} {status} />
<StatusContainer spin={starting} {status} />
{/key}
</div>

<div transition:fade={{ delay: 250, duration: 300 }} class="landscape:hidden">
<StatusContainer emoji={true}>
<StatusContainer>
<svelte:fragment slot="status-slot">
{#if isMobile}
{$_('page.Rotate')} 🔄
{$_('page.Rotate')}<span class="font-emoji">🔄</span>
{:else}
{$_('page.Resize')} ↔️
{$_('page.Resize')}<span class="font-emoji">↔️</span>
{/if}
</svelte:fragment>
</StatusContainer>
Expand Down
10 changes: 2 additions & 8 deletions src/asteroids-website/src/routes/status-container.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script lang="ts">
import { fade, blur, fly, slide, scale } from 'svelte/transition';
export let status: string | undefined = undefined;
export let emoji: boolean = false;
export let spin: boolean = false;
</script>

Expand All @@ -11,11 +10,11 @@
class="absolute flex top-0 bottom-0 left-0 right-0 items-center justify-center pointer-events-none -z-50"
>
<div id="status-container" class="rounded-lg bg-green-light/[.5] shadow-xl p-8 m-8">
<div class="select-none text-center text-2xl lg:text-6xl font-bold" class:emoji id="status">
<div class="select-none text-center text-2xl lg:text-6xl font-bold" id="status">
<div class="jsonly" class:spin>
<slot name="status-slot" />
{#if status}
{status}
<span class="whitespace-pre-line">{status}</span>
{/if}
</div>
<noscript>Please enable Javascript to play.</noscript>
Expand All @@ -24,11 +23,6 @@
</div>

<style global lang="postcss">
.emoji {
font-family: Apple Color Emoji, Segoe UI Emoji, Noto Color Emoji, Android Emoji, EmojiSymbols,
EmojiOne Mozilla, Twemoji Mozilla, Segoe UI Symbol, Noto Color Emoji Compat, emoji,
noto-emojipedia-fallback;
}
.spin {
@apply animate-spin;
}
Expand Down
Binary file added src/asteroids-website/static/HyperspaceBold.ttf
Binary file not shown.
6 changes: 5 additions & 1 deletion src/asteroids-website/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ export default {
animation: {
pingSlow: 'ping 1.5s ease-in-out infinite'
}
}
},
fontFamily: {
sans: ["Hyperspace", "sans-serif"],
emoji: ["Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Android Emoji", "EmojiSymbols", "EmojiOne Mozilla", "Twemoji Mozilla", "Segoe UI Symbol", "Noto Color Emoji Compat", "emoji", "noto-emojipedia-fallback"]
},
},
plugins: []
};

0 comments on commit 4fff67a

Please sign in to comment.