Skip to content

Commit 3349a4e

Browse files
committed
feat: improve 404 page
1 parent 6b9b23c commit 3349a4e

File tree

6 files changed

+43
-16
lines changed

6 files changed

+43
-16
lines changed

Sources/Pages/Components/FooterView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ struct FooterView: HTML {
2222
"."
2323
}
2424
}
25-
.inlineStyle("padding", "1rem 1.5rem")
2625
.containerStyling()
26+
.inlineStyle("padding", "1rem 1.5rem")
2727
}
2828
.inlineStyle("text-align", "center")
2929
.wrappedStyling()

Sources/Pages/Components/HeaderView.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ import Elementary
22

33
struct HeaderView: HTML {
44
var content: some HTML {
5-
EmptyHTML()
5+
header {
6+
hgroup {
7+
code { "erikb.dev()" }
8+
.inlineStyle("font-size", "0.84em")
9+
.inlineStyle("color", "#AAA")
10+
// TODO: Add buttons to allow switching between code styling or plain text
11+
}
12+
.containerStyling()
13+
.inlineStyle("display", "flex")
14+
.inlineStyle("padding", "0.75rem 1.5rem")
15+
}
16+
.wrappedStyling()
617
}
718
}

Sources/Pages/Components/Spacer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ struct Spacer: HTML {
44
var content: some HTML {
55
div {
66
div {}
7+
.containerStyling()
78
.inlineStyle("height", "0.85rem")
89
.inlineStyle("background", "repeating-linear-gradient(45deg, transparent 0% 35%, #333 35% 50%, transparent 50% 85%, #333 85% 100%)")
910
.inlineStyle("background-size", "5px 5px")
10-
.containerStyling()
1111
}
1212
.wrappedStyling()
1313
}

Sources/Pages/Components/Stylings.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extension HTML where Tag: HTMLTrait.Attributes.Global {
66
}
77

88
func containerStyling() -> _HTMLInlineStyle<Self> {
9-
self.inlineStyle("max-width", "40rem", media: .minWidth(688))
9+
self.inlineStyle("max-width", "40rem", media: .minWidth(712))
1010
.inlineStyle("margin-right", "auto")
1111
.inlineStyle("margin-left", "auto")
1212
.inlineStyle("border-left", "1px solid #303030", media: .minWidth(640))

Sources/Pages/Models/Post+AllCases.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ extension Post: CaseIterable {
6262
links: [
6363
Post.Link(
6464
title: "GitHub",
65-
href: "https://github.com/errorerrorerror/erikbautista.dev",
65+
href: "https://github.com/erikbdev/erikbautista.dev",
6666
role: .primary
6767
),
6868
]

Sources/Pages/NotFoundPage.swift

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,45 @@ public struct NotFoundPage: Page {
1818
section {
1919
div {
2020
div {
21-
h2 { "404 Error | Page Not Found" }
22-
.inlineStyle("margin-bottom", "0.5rem")
23-
pre {
24-
code(.class("hljs language-swift")) {
25-
"""
26-
throw Error.pageNotFound
27-
"""
28-
}
29-
}
21+
Heading()
3022
}
3123
}
3224
.containerStyling()
3325
.inlineStyle("display", "flex")
3426
.inlineStyle("flex-direction", "column")
3527
.inlineStyle("justify-content", "center")
3628
.inlineStyle("align-items", "center")
37-
.inlineStyle("padding", "120px 16px")
38-
.inlineStyle("gap", "1.5rem")
29+
.inlineStyle("padding", "160px 32px")
30+
.inlineStyle("background-image", "radial-gradient(#2A2A2A 1px, transparent 0)")
31+
.inlineStyle("background-size", "12px 12px")
3932
}
4033
.wrappedStyling()
4134
}
4235
Spacer()
4336
FooterView()
4437
}
4538
}
39+
40+
private struct Heading: HTML {
41+
var content: some HTML {
42+
pre {
43+
code { "// 404 ERROR" }
44+
.inlineStyle("font-size", "0.9em")
45+
.inlineStyle("color", "#808080")
46+
.inlineStyle("margin-bottom", "0.125rem")
47+
}
48+
49+
h2 { "Page Not Found" }
50+
.inlineStyle("margin-bottom", "0.5rem")
51+
52+
pre {
53+
code(.class("hljs language-swift")) {
54+
"""
55+
throw Error.pageNotFound
56+
"""
57+
}
58+
.inlineStyle("font-size", "0.9em")
59+
}
60+
}
61+
}
4662
}

0 commit comments

Comments
 (0)