forge
Explore
Log in

Don't you dare go Hollow

personality

Clone
★ 0

0 watching0 forksRustGPL-3.0460.1 KiB4de8815Tahinli7 days ago22 commits

app.rs107 lines, 3.9 KiBHistoryRawDownload
1mod assets;
2mod blocks;
3mod posts;
4mod projects;
5
6use topcoat::{
7 Result,
8 context::{Cx, context},
9 router::{Router, RouterBuilderDiscoverExt, Slot, href, layout, module_router, page},
10 view::{View, component, view},
11};
12
13use crate::content::{posts::Post, projects::Project};
14
15pub struct Title(pub fn(&Cx) -> String);
16
17pub fn router() -> Router {
18 module_router!().discover().build()
19}
20
21#[component]
22async fn site_header(cx: &Cx) -> Result<impl View> {
23 let posts = href!(posts::index);
24 let projects = href!(projects::index);
25 let posts_current = posts.is_current(cx);
26 let projects_current = projects.is_current(cx);
27
28 Ok(view! {
29 <header class="site-header">
30 <a class="wordmark" href=(href!(home))>"tahinli"</a>
31 <nav class="nav" aria-label="Main">
32 <a href=(posts) aria-current=(posts_current.then_some("page"))>"posts"</a>
33 <a href=(projects) aria-current=(projects_current.then_some("page"))>"projects"</a>
34 <a href="https://git.tahinli.com/Tahinli">"forge"</a>
35 </nav>
36 </header>
37 })
38}
39
40#[component]
41async fn site_footer(cx: &Cx) -> Result<impl View> {
42 Ok(view! {
43 <footer class="site-footer">
44 <span>"Don't you dare go Hollow"</span>
45 <span class="footer-links">
46 <a href="https://github.com/Tahinli">"github"</a>
47 <a href="https://linkedin.com/in/ahmetkaangumus">"linkedin"</a>
48 </span>
49 </footer>
50 })
51}
52
53#[layout(with(Title(|_| "Ahmet Kaan Gümüş".to_owned())))]
54async fn root_layout(cx: &Cx, slot: Slot<'_>) -> Result<impl View> {
55 let Title(render) = context::<Title>(cx);
56 let title = render(cx);
57
58 Ok(view! {
59 <!DOCTYPE html>
60 <html lang="en">
61 <head>
62 <meta charset="utf-8">
63 <meta name="viewport" content="width=device-width, initial-scale=1">
64 <title>(title)</title>
65 <link rel="stylesheet" href="/main.css">
66 <script src="/nav.js" defer=""></script>
67 <link rel="icon" href="/favicon.ico" type="image/x-icon">
68 </head>
69 <body>
70 <div class="glass">
71 site_header()
72 <main>(slot)</main>
73 site_footer()
74 </div>
75 </body>
76 </html>
77 })
78}
79
80#[page]
81async fn home(cx: &Cx) -> Result<impl View> {
82 Ok(view! {
83 <section class="hero">
84 <h1>"Ahmet Kaan Gümüş"</h1>
85 <p class="lead">"Computer Scientist."</p>
86 <div class="about">
87 <p>"I’m Ahmet Kaan. I’m Turkish and was born in 2001. I graduated with a degree in Computer Engineering from Erciyes University. I’m keen on understanding computers as deeply as possible and I love the open‑source philosophy and the KISS principle."</p>
88 <p>"My passion is to create software that can stand the test of time. Developers should write versatile, bug‑free programs. It’s impossible to ignore the impact of software. Today’s world is led by it and will continue to be. As developers, we must consider as many possibilities as we can in order to build robust and secure applications."</p>
89 <p>"I hope to create free and open‑source software that is widely used, allowing people to benefit from it without having to worry about privacy or the reliability of the program."</p>
90 </div>
91 </section>
92
93 <section class="section">
94 <h2 class="label">"Writing"</h2>
95 for post in Post::ALL {
96 posts::post_row(post: post)
97 }
98 </section>
99
100 <section class="section">
101 <h2 class="label">"Projects"</h2>
102 for project in Project::ALL {
103 projects::project_row(project: project)
104 }
105 </section>
106 })
107}