Add draft with color

This commit is contained in:
Florian RICHER 2023-12-09 21:48:40 +01:00
parent b8bd9d0607
commit f7339b36e4
5 changed files with 21 additions and 2 deletions

View file

@ -7,6 +7,7 @@ pub struct PostMetadata {
pub date: String,
pub description: String,
pub project_link: String,
pub draft: bool
}
#[derive(Clone, Serialize, Deserialize, Debug)]

View file

@ -73,6 +73,19 @@ pub fn PostElement() -> impl IntoView {
view! {
<>
<Title href="/posts".to_string() title=post.metadata.title.clone()/>
{
if post.metadata.draft {
Some(view!{
<div class="bg-warning text-on_warning dark:bg-dark_warning dark:text-dart_on_warning rounded-md p-5">
r#"
L'article est en cours d'écriture. La formulation peut ne pas être exacte et les phrases peuvent contenir des fautes.
"#
</div>
})
} else {
None
}
}
<div inner_html={post.content.clone()}></div>
</>
}