Adding some routing.
Moving more of the Blog pieces into the Blog library.
This commit is contained in:
41
bard/src/pages/blog.rs
Normal file
41
bard/src/pages/blog.rs
Normal file
@ -0,0 +1,41 @@
|
||||
use dioxus::prelude::*;
|
||||
|
||||
use crate::page::Page;
|
||||
|
||||
use crate::components::BlogList;
|
||||
|
||||
|
||||
|
||||
const BLOG_CSS: Asset = asset!("/assets/css/blog.css");
|
||||
|
||||
|
||||
|
||||
/// Blog page
|
||||
#[component]
|
||||
pub fn Blog(tag: String) -> Element
|
||||
{
|
||||
let mut categories: Vec<String> = vec![];
|
||||
|
||||
if !tag.is_empty()
|
||||
{
|
||||
categories.push(tag);
|
||||
}
|
||||
|
||||
rsx!
|
||||
{
|
||||
document::Stylesheet { href: BLOG_CSS }
|
||||
|
||||
main
|
||||
{
|
||||
class: "blog_style",
|
||||
div
|
||||
{
|
||||
class: "page_content",
|
||||
BlogList
|
||||
{
|
||||
tags: categories
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
33
bard/src/pages/post.rs
Normal file
33
bard/src/pages/post.rs
Normal file
@ -0,0 +1,33 @@
|
||||
use dioxus::prelude::*;
|
||||
|
||||
use crate::page::Page;
|
||||
use crate::components::BlogPost;
|
||||
|
||||
|
||||
|
||||
const BLOG_CSS: Asset = asset!("/assets/css/blog.css");
|
||||
|
||||
|
||||
|
||||
/// Blog page
|
||||
#[component]
|
||||
pub fn Post(slug: String) -> Element
|
||||
{
|
||||
rsx!
|
||||
{
|
||||
document::Stylesheet { href: BLOG_CSS }
|
||||
|
||||
main
|
||||
{
|
||||
class: "blog_style",
|
||||
div
|
||||
{
|
||||
class: "page_content",
|
||||
BlogPost
|
||||
{
|
||||
slug: slug
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user