Skip to content

Commit 4f8f9f2

Browse files
authored
Apply the website design on the 404 page (#10)
* Apply the website design on the 404 page * fix test
1 parent 6a3ab31 commit 4f8f9f2

3 files changed

Lines changed: 45 additions & 36 deletions

File tree

lib/jola_dev_web/controllers/error_html/404.html.heex

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,53 @@
1-
<section class="py-16 min-h-[60vh] flex items-center justify-center">
2-
<div class="max-w-prose mx-auto px-6 md:px-8 text-center">
3-
<div class="mb-8">
4-
<.icon
5-
name="hero-exclamation-triangle"
6-
class="w-24 h-24 mx-auto text-muted-foreground opacity-50"
7-
/>
8-
</div>
9-
10-
<.heading level={1} class="mb-4">Page Not Found</.heading>
1+
<section class="py-16">
2+
<div class="max-w-content mx-auto px-6 md:px-8">
3+
<header class="mb-12 text-center">
4+
<.heading level={1}>404 - Page Not Found</.heading>
5+
<.text variant={:lead} class="mt-4">
6+
The page you're looking for seems to have wandered off
7+
</.text>
8+
</header>
119

12-
<.text variant={:lead} class="mb-8">
13-
Oops! The page you're looking for doesn't exist.
14-
</.text>
10+
<div class="max-w-prose mx-auto text-center mb-12">
11+
<.text variant={:muted} class="mb-8">
12+
Don't worry! Here are some helpful places to explore instead:
13+
</.text>
14+
</div>
1515

16-
<.text variant={:muted} class="mb-12">
17-
It might have been moved, deleted, or you may have typed the URL incorrectly.
18-
</.text>
16+
<div class="grid md:grid-cols-3 gap-6 max-w-4xl mx-auto mb-12">
17+
<.link href="/" class="block group">
18+
<.card variant={:bordered} hover class="text-center h-full">
19+
<.icon name="hero-home" class="w-12 h-12 mx-auto mb-4 text-accent" />
20+
<.heading level={4}>Homepage</.heading>
21+
<.text variant={:muted} class="mt-2">
22+
Start fresh from the beginning
23+
</.text>
24+
</.card>
25+
</.link>
1926

20-
<div class="flex flex-col sm:flex-row gap-4 justify-center items-center">
21-
<.link
22-
href="/"
23-
class="inline-flex items-center gap-2 px-6 py-3 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors"
24-
>
25-
<.icon name="hero-home" class="w-5 h-5" /> Go to Homepage
27+
<.link href="/posts" class="block group">
28+
<.card variant={:bordered} hover class="text-center h-full">
29+
<.icon name="hero-document-text" class="w-12 h-12 mx-auto mb-4 text-accent" />
30+
<.heading level={4}>Blog</.heading>
31+
<.text variant={:muted} class="mt-2">
32+
Read my latest thoughts and articles
33+
</.text>
34+
</.card>
2635
</.link>
2736

28-
<.link
29-
href="/posts"
30-
class="inline-flex items-center gap-2 px-6 py-3 border border-border rounded-lg hover:bg-accent transition-colors"
31-
>
32-
<.icon name="hero-document-text" class="w-5 h-5" /> View Blog Posts
37+
<.link href="/projects" class="block group">
38+
<.card variant={:bordered} hover class="text-center h-full">
39+
<.icon name="hero-code-bracket-square" class="w-12 h-12 mx-auto mb-4 text-accent" />
40+
<.heading level={4}>Projects</.heading>
41+
<.text variant={:muted} class="mt-2">
42+
Explore my open source work
43+
</.text>
44+
</.card>
3345
</.link>
3446
</div>
3547

36-
<div class="mt-16 pt-8 border-t border-border">
48+
<div class="text-center">
3749
<.text variant={:muted}>
38-
You can also try navigating using the menu above, or <.link
39-
href="/about"
40-
class="text-accent hover:underline"
41-
>learn more about me</.link>.
50+
Looking for something specific? Try the navigation menu above.
4251
</.text>
4352
</div>
4453
</div>

test/jola_dev_web/controllers/blog_controller_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ defmodule JolaDevWeb.BlogControllerTest do
2929

3030
html = html_response(conn, 404)
3131
assert html =~ "Page Not Found"
32-
assert html =~ "The page you're looking for doesn't exist"
32+
assert html =~ "The page you're looking for seems to have wandered off"
3333
end
3434
end
3535
end

test/jola_dev_web/controllers/error_html_test.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ defmodule JolaDevWeb.ErrorHTMLTest do
77
test "renders 404.html" do
88
html = render_to_string(JolaDevWeb.ErrorHTML, "404", "html", [])
99
assert html =~ "Page Not Found"
10-
assert html =~ "The page you're looking for doesn't exist"
11-
assert html =~ "Go to Homepage"
12-
assert html =~ "View Blog Posts"
10+
assert html =~ "The page you're looking for seems to have wandered off"
11+
assert html =~ "Homepage"
12+
assert html =~ "Blog"
1313
end
1414

1515
test "renders 500.html" do

0 commit comments

Comments
 (0)