Skip to content

Commit 74e6a6a

Browse files
Add basic index page
1 parent 4d3cae7 commit 74e6a6a

File tree

4 files changed

+115
-2
lines changed

4 files changed

+115
-2
lines changed

src/build.gleam

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub fn main() {
1717
let build =
1818
ssg.new("./priv")
1919
|> ssg.add_static_route("/", index.view())
20+
|> ssg.add_static_dir("./static")
2021
// |> ssg.add_static_route("/blog", blog.view(posts.all()))
2122
// |> ssg.add_dynamic_route("/blog", posts, post.view)
2223
|> ssg.build

src/website/components.gleam

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import lustre/attribute.{attribute}
2+
import lustre/element.{type Element}
3+
import lustre/element/html
4+
5+
pub fn head(page: String) -> Element(a) {
6+
html.head([], [
7+
html.meta([attribute("charset", "UTF-8")]),
8+
html.title([], "Gears | " <> page),
9+
html.link([attribute.href("/style.css"), attribute.rel("stylesheet")]),
10+
html.link([attribute.href("https://rsms.me/"), attribute.rel("preconnect")]),
11+
html.link([
12+
attribute.href("https://rsms.me/inter/inter.css"),
13+
attribute.rel("stylesheet"),
14+
]),
15+
html.link([
16+
attribute.type_("image/svg+xml"),
17+
attribute.href("/favicon.svg"),
18+
attribute.rel("icon"),
19+
]),
20+
html.link([
21+
attribute("sizes", "48x48"),
22+
attribute.type_("image/png"),
23+
attribute.href("/favicon.ico"),
24+
attribute.rel("alternate icon"),
25+
]),
26+
html.link([
27+
attribute("sizes", "192x192"),
28+
attribute.href("/apple-touch-icon.png"),
29+
attribute.rel("apple-touch-icon"),
30+
]),
31+
])
32+
}
33+
34+
pub fn page(name: String, body: List(Element(a))) -> Element(a) {
35+
html.html([attribute("lang", "en")], [head(name), html.body([], body)])
36+
}

src/website/page/index.gleam

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
1-
import lustre/element
1+
import lustre/attribute.{attribute}
2+
import lustre/element/html
3+
import website/components
24

35
pub fn view() {
4-
element.text("Hello!")
6+
components.page("Home", [
7+
html.main([], [
8+
html.div([], [
9+
html.h1([], [html.text("Hello and welcome to my website!")]),
10+
]),
11+
html.div([], [
12+
html.p([], [
13+
html.text("I am Gears, a software developer and Minecraft YouTuber."),
14+
html.br([]),
15+
html.text("More about me in the "),
16+
html.a([attribute.href("/about/")], [html.text("about")]),
17+
html.text(" section."),
18+
html.br([]),
19+
html.text("You can check out my finished and ongoing projects in "),
20+
html.a([attribute.href("/projects/")], [html.text("projects")]),
21+
html.text("."),
22+
html.br([]),
23+
html.text("For information on Minecraft datapack commissions, see "),
24+
html.a([attribute.href("/commissions/")], [html.text("commissions")]),
25+
html.text("."),
26+
html.br([]),
27+
html.text("If you have more questions, you can "),
28+
html.a([attribute.href("/contact/")], [html.text("contact me")]),
29+
html.text("."),
30+
]),
31+
]),
32+
]),
33+
])
534
}

static/style.css

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
:root {
2+
font-family: Inter, sans-serif;
3+
font-feature-settings: 'liga' 1, 'calt' 1;
4+
/* fix for Chrome */
5+
}
6+
7+
@supports (font-variation-settings: normal) {
8+
:root {
9+
font-family: InterVariable, sans-serif;
10+
}
11+
}
12+
13+
body {
14+
min-height: 100vh;
15+
background-color: rgb(30, 41, 59);
16+
color: white;
17+
}
18+
19+
main {
20+
padding: 3rem 0px;
21+
display: flex;
22+
justify-content: center;
23+
align-items: center;
24+
flex-direction: column;
25+
}
26+
27+
h1 {
28+
font-weight: bold;
29+
text-align: center;
30+
}
31+
32+
div {
33+
margin: auto 0;
34+
max-width: 48rem;
35+
padding: 1rem;
36+
}
37+
38+
p {
39+
font-size: 1.25rem;
40+
line-height: 1.75rem;
41+
}
42+
43+
a {
44+
color: white;
45+
text-decoration: underline;
46+
font-weight: bold;
47+
}

0 commit comments

Comments
 (0)