Skip to content

Commit

Permalink
feat: Add custom 404 page (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
evadecker authored May 29, 2024
1 parent c27afc8 commit fcbcf99
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 14 deletions.
23 changes: 13 additions & 10 deletions src/layouts/BaseLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,17 @@ const pageTitle = Astro.url.pathname === "/" ? title : `${title} · Namesake`;
<slot />
</main>
<Footer />
</body><style>
main {
flex: 1;
padding: var(--space-2xl) var(--space-l);
min-width: 0;
width: 100%;
max-width: 1200px;
margin-inline: auto;
}
</style>
<style>
main {
flex: 1;
padding: var(--space-2xl) var(--space-l);
min-width: 0;
width: 100%;
max-width: 1200px;
margin-inline: auto;
display: flex;
flex-direction: column;
}
</style>
</body>
</html>
37 changes: 37 additions & 0 deletions src/pages/404.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
import { Image } from "astro:assets";
import emptyShell from "./_images/empty-shell.png";
import BaseLayout from "../layouts/BaseLayout.astro";
---

<BaseLayout
title="We couldn’t find that page"
description="Looks like nobody’s home. Maybe try a different page?"
>
<div class="error">
<Image src={emptyShell} alt="Namesake empty shell" width={240} />
<h1>There’s nothing here</h1>
<p>
We couldn’t find that page. Check the spelling of the URL or <a href="/"
>go home</a
>.
</p>
</div>
</BaseLayout>

<style lang="scss">
.error {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
gap: var(--space-l);
}

p {
font-size: var(--step-3);
text-wrap: balance;
}
</style>
Binary file added src/pages/_images/empty-shell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
6 changes: 2 additions & 4 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { Image } from "astro:assets";
import BaseLayout from "../layouts/BaseLayout.astro";
import { RiArrowRightLine } from "react-icons/ri";
import illustration from "./namesake-form.png";
import formIllustration from "./form-snail.png";
import illustration from "./_images/namesake-form.png";
import formIllustration from "./_images/form-snail.png";
---

<BaseLayout
Expand Down Expand Up @@ -107,11 +107,9 @@ import formIllustration from "./form-snail.png";
}

img {
mix-blend-mode: multiply;
width: 600px;
max-width: 100%;
order: 1;
user-select: none;
}

h1 {
Expand Down
6 changes: 6 additions & 0 deletions src/styles/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ a {
}
}

img {
mix-blend-mode: multiply;
max-width: 100%;
user-select: none;
}

.nowrap {
white-space: nowrap;
}
Expand Down

0 comments on commit fcbcf99

Please sign in to comment.