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

@ -1,6 +1,6 @@
[package]
name = "portfolio"
version = "0.1.1"
version = "0.2.1"
edition = "2021"
[lib]

View file

@ -4,6 +4,7 @@ title: Testing layout
date: 2023-11-26
description: Testing the layout of the site.
project_link: none
draft: true
---
# Heading 1

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>
</>
}

View file

@ -13,7 +13,11 @@ export default {
surface: '#fdfbff',
dark_surface: '#1a1b1e',
on_surface: '#1a1b1e',
dark_on_surface: '#e3e2e6'
dark_on_surface: '#e3e2e6',
on_warning: '#321D0B',
dark_on_warning: '#FFFFFF',
warning: '#fb923c',
dark_warning: '#874512',
}
},
},