From 178fa113a5ceccfdbac6e5399c6c8e6444f60059 Mon Sep 17 00:00:00 2001
From: Florian RICHER
Date: Sun, 26 Nov 2023 20:43:17 +0100
Subject: [PATCH] Add blog list page css
---
markdowns/posts/test_2.md | 68 +++++++++++++++++++++++++++++++++++++++
src/app/mod.rs | 2 +-
src/app/pages/posts.rs | 25 ++++++++------
style/portfolio.css | 1 +
style/post.css | 34 ++++++++++++++++++++
5 files changed, 120 insertions(+), 10 deletions(-)
create mode 100644 markdowns/posts/test_2.md
create mode 100644 style/post.css
diff --git a/markdowns/posts/test_2.md b/markdowns/posts/test_2.md
new file mode 100644
index 0000000..f508f0a
--- /dev/null
+++ b/markdowns/posts/test_2.md
@@ -0,0 +1,68 @@
+---
+image_path: "https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Test-Logo.svg/783px-Test-Logo.svg.png?20150906031702"
+title: Testing layout 2
+date: 2023-11-27
+description: Testing the layout of the site 2.
+project_link: none
+---
+
+### Heading Tags
+
+# Heading 1
+## Heading 2
+### Heading 3
+#### Heading 4
+##### Heading 5
+###### Heading 6
+
+This is a paragraph tag. It's used for displaying text content.
+
+[Click me to visit Example website!](https://www.example.com)
+
+Unordered list
+
+* Item 1
+* Item 2
+* Item 3
+
+Ordered list
+
+1. Item 1
+2. Item 2
+3. Item 3
+
+
+> It's probably important that images look okay here by default as well:
+
+
+
+### Code Blocks
+
+```python
+def hello_world():
+ print("Hello World!")
+```
+
+```rust
+fn main() {
+ println!("Hello World!");
+}
+```
+
+```javascript
+function helloWorld() {
+ console.log("Hello World!");
+}
+```
+
+```ruby
+def hello_world
+ puts "Hello World!"
+end
+```
+
+```dockerfile
+FROM rust
+RUN cargo build --release
+CMD ["./target/release/hello_world"]
+```
diff --git a/src/app/mod.rs b/src/app/mod.rs
index 529816f..ddf26e7 100644
--- a/src/app/mod.rs
+++ b/src/app/mod.rs
@@ -1,4 +1,4 @@
-mod components;
+pub mod components;
pub mod models;
mod pages;
diff --git a/src/app/pages/posts.rs b/src/app/pages/posts.rs
index ae59dc2..801c1ff 100644
--- a/src/app/pages/posts.rs
+++ b/src/app/pages/posts.rs
@@ -1,6 +1,7 @@
use leptos::*;
use leptos_router::*;
use crate::app::models::Post;
+use crate::app::components::Link;
#[server]
pub async fn get_posts() -> Result, ServerFnError> {
@@ -31,20 +32,26 @@ pub fn PostList() -> impl IntoView {
posts.and_then(|posts| {
posts.iter()
.map(|post| view! {
-
- {post.metadata.title.clone()}
-
+
+
+
+
+
{post.metadata.title.clone()}
+
{post.metadata.description.clone()}
+
{post.metadata.date.clone()}
+
+
})
.collect_view()
})
};
view! {
-
- "My Great Blog"
+
+ Blog
- "Loading posts..."
}>
-
+ "Chargement des posts..." }>
+ {posts_view}
}
@@ -66,8 +73,8 @@ pub fn PostElement() -> impl IntoView {
};
view! {
-
- "Loading posts..." }>
+
+ "Chargement des posts..." }>
{post_view}
diff --git a/style/portfolio.css b/style/portfolio.css
index 6f0eecf..131a8d9 100644
--- a/style/portfolio.css
+++ b/style/portfolio.css
@@ -4,6 +4,7 @@
@import './link.css';
@import './project.css';
+@import './post.css';
@import './social_links.css';
@import './tag.css';
@import './timeline.css';
diff --git a/style/post.css b/style/post.css
new file mode 100644
index 0000000..5c578f1
--- /dev/null
+++ b/style/post.css
@@ -0,0 +1,34 @@
+@layer components {
+ .posts, .post {
+ @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;
+ }
+ }
+
+ .posts {
+ & > .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 {
+ @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;
+
+ & > img {
+ @apply w-full h-48 object-cover;
+ }
+
+ & > div {
+ @apply p-5 flex flex-col gap-3;
+
+ & > h2 {
+ @apply font-bold text-2xl;
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file