From a31fa68e8440fd922e21abcb556c59601fae1f21 Mon Sep 17 00:00:00 2001
From: Florian RICHER
Date: Sun, 26 Nov 2023 21:36:28 +0100
Subject: [PATCH] Add blog page css
---
Cargo.toml | 2 +-
src/app/mod.rs | 8 ++++----
src/app/pages/posts.rs | 7 +++----
style/post.css | 41 ++++++++++++++++++++++++++++++++++-------
4 files changed, 42 insertions(+), 16 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index 8188feb..a2f7b53 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -37,7 +37,7 @@ actix-files = { version = "0.6", optional = true }
actix-web = { version = "4", features = ["macros"], optional = true }
futures = { version = "0.3", optional = true }
simple_logger = { version = "4.2", optional = true }
-pulldown-cmark = { version = "0.9", optional = true } # markdown parser
+pulldown-cmark = { version = "0.9", optional = true } # Markdown parser
gray_matter = { version = "0.2", optional = true } # frontmatter parser
[features]
diff --git a/src/app/mod.rs b/src/app/mod.rs
index ddf26e7..1e26fb2 100644
--- a/src/app/mod.rs
+++ b/src/app/mod.rs
@@ -13,15 +13,15 @@ pub fn App() -> impl IntoView {
view! {
+
+
-
-
-
+
+
}/>
diff --git a/src/app/pages/posts.rs b/src/app/pages/posts.rs
index 801c1ff..9e79737 100644
--- a/src/app/pages/posts.rs
+++ b/src/app/pages/posts.rs
@@ -1,7 +1,6 @@
use leptos::*;
use leptos_router::*;
use crate::app::models::Post;
-use crate::app::components::Link;
#[server]
pub async fn get_posts() -> Result, ServerFnError> {
@@ -32,7 +31,7 @@ pub fn PostList() -> impl IntoView {
posts.and_then(|posts| {
posts.iter()
.map(|post| view! {
-
+
})
.collect_view()
})
@@ -75,7 +74,7 @@ pub fn PostElement() -> impl IntoView {
view! {
"Chargement des posts..."
}>
- {post_view}
+ {post_view}
}
diff --git a/style/post.css b/style/post.css
index 5c578f1..db2e92f 100644
--- a/style/post.css
+++ b/style/post.css
@@ -3,8 +3,28 @@
@apply bg-surface dark:bg-dark_surface text-on_surface dark:text-dark_on_surface;
@apply min-h-screen py-5;
- & > h1 {
- @apply font-bold text-3xl text-center;
+ & h1 {
+ @apply font-bold text-3xl;
+ }
+
+ & h2 {
+ @apply font-bold text-2xl;
+ }
+
+ & h3 {
+ @apply font-bold text-xl;
+ }
+
+ & h4 {
+ @apply font-bold text-lg;
+ }
+
+ & h5 {
+ @apply font-bold text-base;
+ }
+
+ & h6 {
+ @apply font-bold text-sm;
}
}
@@ -12,7 +32,7 @@
& > .posts__cards {
@apply grid grid-cols-1 gap-5 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 m-5;
- & > div {
+ & > a {
@apply rounded-xl overflow-hidden relative;
@apply bg-primary/10 dark:bg-dark_primary/10;
@apply shadow-md shadow-primary/5 dark:shadow-dark_primary/5;
@@ -23,12 +43,19 @@
& > div {
@apply p-5 flex flex-col gap-3;
-
- & > h2 {
- @apply font-bold text-2xl;
- }
}
}
}
}
+
+ .post {
+ & > div {
+ @apply mx-auto max-w-3xl;
+ @apply flex flex-col gap-5;
+ }
+
+ & pre > code {
+ @apply rounded-md my-2;
+ }
+ }
}
\ No newline at end of file