Refactor title to nav
This commit is contained in:
parent
60a36f0eb8
commit
9cd4298764
14 changed files with 98 additions and 61 deletions
|
@ -4,7 +4,7 @@ use leptos_router::*;
|
|||
use crate::app::{
|
||||
models::Post,
|
||||
components::{
|
||||
Title, Loading
|
||||
Loading, Nav
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -107,16 +107,10 @@ pub fn PostList() -> impl IntoView {
|
|||
})
|
||||
};
|
||||
|
||||
let title = move || match tag() {
|
||||
Some(tag) => view! { <Title href="/posts".to_string() title=format!("Posts for {}", tag)/> },
|
||||
None => view! { <Title href="/".to_string() title="Posts".to_string()/> }
|
||||
};
|
||||
|
||||
view! {
|
||||
<Suspense fallback=move || view! { <Loading title="Chargement des posts...".to_string() /> }>
|
||||
<Nav/>
|
||||
<main class="posts">
|
||||
{ title }
|
||||
|
||||
<div class="posts__cards">{posts_view}</div>
|
||||
</main>
|
||||
</Suspense>
|
||||
|
@ -134,7 +128,6 @@ pub fn PostElement() -> impl IntoView {
|
|||
post.and_then(|post| {
|
||||
view! {
|
||||
<>
|
||||
<Title href="/posts".to_string() title=post.metadata.title.clone()/>
|
||||
<PostTags tags=post.metadata.tags.clone()/>
|
||||
{
|
||||
if post.metadata.draft {
|
||||
|
@ -157,6 +150,7 @@ pub fn PostElement() -> impl IntoView {
|
|||
|
||||
view! {
|
||||
<Suspense fallback=move || view! { <Loading title="Chargement du post...".to_string() /> }>
|
||||
<Nav/>
|
||||
<main class="post">
|
||||
{post_view}
|
||||
<script>load();</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue