+
+
+ {
+ if post.metadata.draft {
+ Some(view!{
+
+
+
+ })
+ } else {
+ None
+ }
+ }
+
+
+
+ {post.metadata.title.clone()}
+ {post.metadata.description.clone()}
+ {post.metadata.date.clone()}
+
+
+ }
+}
+
#[component]
pub fn PostList() -> impl IntoView {
- let posts = create_resource(|| (), |_| get_posts());
+ let query = use_query_map();
+ let tag = move || query.with(|query| query.get("tag").cloned());
+ let posts = create_resource(move || tag(), move |_| get_posts(tag()));
let posts_view = move || {
posts.and_then(|posts| {
posts.iter()
- .map(|post| view! {
-