forge
Explore
Log in

Don't you dare go Hollow

personality

Clone
★ 0

0 watching0 forksRustGPL-3.0460.1 KiB4de8815Tahinli7 days ago22 commits

projects.rs34 lines, 899 bytesHistoryRawDownload
1pub mod slug;
2
3use topcoat::{
4 Result,
5 context::Cx,
6 router::{href, page},
7 view::{View, component, view},
8};
9
10use crate::{app::Title, content::projects::Project};
11
12pub fn detail_url(cx: &Cx, project: Project) -> String {
13 href!(slug::detail, slug: project.slug()).resolve(cx)
14}
15
16#[component]
17pub async fn project_row(cx: &Cx, project: Project) -> Result<impl View> {
18 Ok(view! {
19 <a class="row" href=(detail_url(cx, project))>
20 <span class="row-key">(project.slug())</span>
21 <span>(project.name()) <span class="row-sub">" · " (project.summary())</span></span>
22 </a>
23 })
24}
25
26#[page(with(Title(|_| "Projects · tahinli".to_owned())))]
27pub async fn index(cx: &Cx) -> Result<impl View> {
28 Ok(view! {
29 <h2 class="label">"Projects"</h2>
30 for project in Project::ALL {
31 project_row(project: project)
32 }
33 })
34}