Merge pull request 'Ajout post' (#4) from add-posts into main
All checks were successful
deploy / docker (push) Successful in 13m45s

Reviewed-on: https://gitea.mrdev023.fr/florian.richer/portfolio/pulls/4
This commit is contained in:
florian.richer 2023-12-09 19:51:17 +01:00
commit b8bd9d0607
26 changed files with 4303 additions and 112 deletions

194
Cargo.lock generated
View file

@ -555,7 +555,7 @@ checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6"
dependencies = [
"is-terminal",
"lazy_static",
"windows-sys 0.48.0",
"windows-sys",
]
[[package]]
@ -566,9 +566,9 @@ checksum = "f3f6d59c71e7dc3af60f0af9db32364d96a16e9310f3f5db2b55ed642162dd35"
[[package]]
name = "config"
version = "0.13.3"
version = "0.13.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d379af7f68bfc21714c6c7dea883544201741d2ce8274bb12fa54f89507f52a7"
checksum = "23738e11972c7643e4ec947840fc463b6a571afcd3e735bdfce7d03c7a784aca"
dependencies = [
"async-trait",
"lazy_static",
@ -800,7 +800,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8"
dependencies = [
"libc",
"windows-sys 0.48.0",
"windows-sys",
]
[[package]]
@ -821,9 +821,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "form_urlencoded"
version = "1.2.0"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652"
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
dependencies = [
"percent-encoding",
]
@ -933,6 +933,15 @@ dependencies = [
"version_check",
]
[[package]]
name = "getopts"
version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5"
dependencies = [
"unicode-width",
]
[[package]]
name = "getrandom"
version = "0.2.11"
@ -948,9 +957,9 @@ dependencies = [
[[package]]
name = "gimli"
version = "0.28.0"
version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
[[package]]
name = "gloo-net"
@ -1019,6 +1028,18 @@ dependencies = [
"web-sys",
]
[[package]]
name = "gray_matter"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cf2fb99fac0b821a4e61c61abff076324bb0e5c3b4a83815bbc3518a38971ad"
dependencies = [
"serde",
"serde_json",
"toml",
"yaml-rust",
]
[[package]]
name = "h2"
version = "0.3.22"
@ -1061,9 +1082,9 @@ checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
[[package]]
name = "hashbrown"
version = "0.14.2"
version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
dependencies = [
"ahash 0.8.6",
"allocator-api2",
@ -1191,9 +1212,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "idna"
version = "0.4.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
dependencies = [
"unicode-bidi",
"unicode-normalization",
@ -1206,7 +1227,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
dependencies = [
"equivalent",
"hashbrown 0.14.2",
"hashbrown 0.14.3",
]
[[package]]
@ -1244,7 +1265,7 @@ checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
dependencies = [
"hermit-abi",
"rustix",
"windows-sys 0.48.0",
"windows-sys",
]
[[package]]
@ -1556,6 +1577,12 @@ dependencies = [
"serde_test",
]
[[package]]
name = "linked-hash-map"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "linux-raw-sys"
version = "0.4.11"
@ -1601,7 +1628,7 @@ version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4a83fb7698b3643a0e34f9ae6f2e8f0178c0fd42f8b59d493aa271ff3a5bf21"
dependencies = [
"hashbrown 0.14.2",
"hashbrown 0.14.3",
]
[[package]]
@ -1673,7 +1700,7 @@ dependencies = [
"libc",
"log",
"wasi",
"windows-sys 0.48.0",
"windows-sys",
]
[[package]]
@ -1753,9 +1780,9 @@ checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
[[package]]
name = "percent-encoding"
version = "2.3.0"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "pin-project"
@ -1806,12 +1833,15 @@ dependencies = [
"console_log",
"futures",
"gloo-net 0.4.0",
"gray_matter",
"leptos",
"leptos_actix",
"leptos_icons",
"leptos_meta",
"leptos_router",
"log",
"pulldown-cmark",
"serde",
"simple_logger",
"wasm-bindgen",
]
@ -1874,9 +1904,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.69"
version = "1.0.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
dependencies = [
"unicode-ident",
]
@ -1914,6 +1944,18 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "pulldown-cmark"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998"
dependencies = [
"bitflags 1.3.2",
"getopts",
"memchr",
"unicase",
]
[[package]]
name = "quote"
version = "1.0.33"
@ -2137,7 +2179,7 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.48.0",
"windows-sys",
]
[[package]]
@ -2181,9 +2223,9 @@ checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090"
[[package]]
name = "serde"
version = "1.0.192"
version = "1.0.193"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001"
checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89"
dependencies = [
"serde_derive",
]
@ -2201,9 +2243,9 @@ dependencies = [
[[package]]
name = "serde_derive"
version = "1.0.192"
version = "1.0.193"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1"
checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
dependencies = [
"proc-macro2",
"quote",
@ -2331,14 +2373,14 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a"
[[package]]
name = "simple_logger"
version = "4.2.0"
version = "4.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2230cd5c29b815c9b699fb610b49a5ed65588f3509d9f0108be3a885da629333"
checksum = "da0ca6504625ee1aa5fda33913d2005eab98c7a42dd85f116ecce3ff54c9d3ef"
dependencies = [
"colored",
"log",
"time",
"windows-sys 0.42.0",
"windows-sys",
]
[[package]]
@ -2383,7 +2425,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9"
dependencies = [
"libc",
"windows-sys 0.48.0",
"windows-sys",
]
[[package]]
@ -2533,7 +2575,7 @@ dependencies = [
"pin-project-lite",
"signal-hook-registry",
"socket2 0.5.5",
"windows-sys 0.48.0",
"windows-sys",
]
[[package]]
@ -2665,6 +2707,12 @@ version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
[[package]]
name = "unicode-width"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
[[package]]
name = "unicode-xid"
version = "0.2.4"
@ -2673,9 +2721,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]]
name = "url"
version = "2.4.1"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5"
checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
dependencies = [
"form_urlencoded",
"idna",
@ -2835,21 +2883,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
"windows_aarch64_gnullvm 0.42.2",
"windows_aarch64_msvc 0.42.2",
"windows_i686_gnu 0.42.2",
"windows_i686_msvc 0.42.2",
"windows_x86_64_gnu 0.42.2",
"windows_x86_64_gnullvm 0.42.2",
"windows_x86_64_msvc 0.42.2",
]
[[package]]
name = "windows-sys"
version = "0.48.0"
@ -2865,93 +2898,51 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
"windows_aarch64_gnullvm 0.48.5",
"windows_aarch64_msvc 0.48.5",
"windows_i686_gnu 0.48.5",
"windows_i686_msvc 0.48.5",
"windows_x86_64_gnu 0.48.5",
"windows_x86_64_gnullvm 0.48.5",
"windows_x86_64_msvc 0.48.5",
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_i686_gnu"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
@ -2965,7 +2956,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
dependencies = [
"cfg-if",
"windows-sys 0.48.0",
"windows-sys",
]
[[package]]
@ -2983,6 +2974,15 @@ version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9828b178da53440fa9c766a3d2f73f7cf5d0ac1fe3980c1e5018d899fd19e07b"
[[package]]
name = "yaml-rust"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
dependencies = [
"linked-hash-map",
]
[[package]]
name = "yansi"
version = "1.0.0-rc.1"

View file

@ -16,6 +16,7 @@ leptos_router = { version = "0.5", features = ["nightly"] }
gloo-net = { version = "0.4", features = ["http"] }
log = "0.4"
cfg-if = "1.0"
serde = "1.0"
# https://carlosted.github.io/icondata/
leptos_icons = { version = "0.1.0", features = [
@ -36,6 +37,8 @@ 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
gray_matter = { version = "0.2", optional = true } # frontmatter parser
[features]
default = ["csr"]
@ -64,6 +67,8 @@ ssr = [
"dep:actix-files",
"dep:futures",
"dep:simple_logger",
"dep:pulldown-cmark",
"dep:gray_matter",
]
[package.metadata.cargo-all-features]

74
markdowns/posts/test.md Normal file
View file

@ -0,0 +1,74 @@
---
image_path: "https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Test-Logo.svg/783px-Test-Logo.svg.png?20150906031702"
title: Testing layout
date: 2023-11-26
description: Testing the layout of the site.
project_link: none
---
# 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:
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Test-Logo.svg/783px-Test-Logo.svg.png?20150906031702">
### 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"]
```
```mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
```

9
public/css/github-dark-dimmed.min.css vendored Normal file
View file

@ -0,0 +1,9 @@
pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*!
Theme: GitHub Dark Dimmed
Description: Dark dimmed theme as seen on github.com
Author: github.com
Maintainer: @Hirse
Updated: 2021-05-15
Colors taken from GitHub's CSS
*/.hljs{color:#adbac7;background:#22272e}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#f47067}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#dcbdfb}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#6cb6ff}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#96d0ff}.hljs-built_in,.hljs-symbol{color:#f69d50}.hljs-code,.hljs-comment,.hljs-formula{color:#768390}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#8ddb8c}.hljs-subst{color:#adbac7}.hljs-section{color:#316dca;font-weight:700}.hljs-bullet{color:#eac55f}.hljs-emphasis{color:#adbac7;font-style:italic}.hljs-strong{color:#adbac7;font-weight:700}.hljs-addition{color:#b4f1b4;background-color:#1b4721}.hljs-deletion{color:#ffd8d3;background-color:#78191b}

10
public/css/github.min.css vendored Normal file
View file

@ -0,0 +1,10 @@
pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*!
Theme: GitHub
Description: Light theme as seen on github.com
Author: github.com
Maintainer: @Hirse
Updated: 2021-05-15
Outdated base version: https://github.com/primer/github-syntax-light
Current colors taken from GitHub's CSS
*/.hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#005cc5}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-code,.hljs-comment,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:700}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:700}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0}

7
public/js/autoload.js Normal file
View file

@ -0,0 +1,7 @@
function load() {
hljs.highlightAll();
mermaid.initialize();
mermaid.run({ querySelector: ".language-mermaid" });
}
window.onload = load;

2044
public/js/highlight.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1646
public/js/mermaid.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,17 @@
use leptos::*;
#[component]
pub fn Loading(
#[prop[optional]]
title: Option<String>
) -> impl IntoView {
view! {
<div class="loading">
<svg class="animate-spin -ml-1 mr-3 h-5 w-5 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
<p>{title}</p>
</div>
}
}

View file

@ -23,5 +23,12 @@ mod timeline;
pub use timeline::{Timeline, TimelineElement, TimelineLabel, TimelineCard, TimelineCardTag, TimelineCardContent, TimelineCardSummary};
mod mon_parcours;
mod loading;
pub use loading::Loading;
mod title;
pub use title::Title;
pub use mon_parcours::{MonParcours};

View file

@ -0,0 +1,16 @@
use leptos::*;
#[component]
pub fn Title(
href: String,
#[prop[optional]]
title: Option<String>
) -> impl IntoView {
view! {
<header>
<a href=href>r"< Retour"</a>
<h1>{title}</h1>
<span></span>
</header>
}
}

View file

@ -23,6 +23,10 @@ pub fn TopComponent() -> impl IntoView {
inépuisable d'apprendre et ma curiosité sans bornes.
"#
</p>
<div class="top_component__actions">
<a href="/experience".to_string()>Mon parcours</a>
<a href="/posts".to_string()>Mon blog</a>
</div>
<SocialLinkContainer>
<SocialLink icon=Icon::from(FaGithubBrands) url="https://github.com/mrdev023".to_string()>Github</SocialLink>
<SocialLink icon=Icon::from(FaLinkedinBrands) url="https://www.linkedin.com/in/florian-richer-80960b129/".to_string()>Linkedin</SocialLink>

View file

@ -1,4 +1,6 @@
mod components;
pub mod components;
pub mod models;
mod pages;
use leptos::*;
use leptos_meta::*;
@ -8,23 +10,23 @@ use leptos_router::*;
pub fn App() -> impl IntoView {
provide_meta_context();
// https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/
view! {
<Stylesheet id="leptos" href="/pkg/portfolio.css"/>
<Link rel="shortcut icon" type_="image/ico" href="/favicon.ico"/>
<Link media="(prefers-color-scheme: dark)" rel="stylesheet" href="/css/github-dark-dimmed.min.css"/>
<Link media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" rel="stylesheet" href="/css/github.min.css"/>
<script src="/js/highlight.min.js"></script>
<script src="/js/mermaid.min.js"></script>
<script src="/js/autoload.js"/>
<Router>
<Routes>
<Route path="" view= move || view! { <Home/> }/>
<Route path="" view=pages::Home/>
<Route path="experience" view=pages::Experience/>
<Route path="posts" view=pages::PostList/>
<Route path="posts/:slug" view=pages::PostElement/>
</Routes>
</Router>
}
}
#[component]
fn Home() -> impl IntoView {
view! {
<main class="m-0 p-0 bg-surface dark:bg-dark_surface text-on_surface dark:text-dark_on_surface">
<components::TopComponent/>
<components::MonParcours/>
</main>
}
}

3
src/app/models/mod.rs Normal file
View file

@ -0,0 +1,3 @@
mod post;
pub use post::Post;

85
src/app/models/post.rs Normal file
View file

@ -0,0 +1,85 @@
use serde::{Deserialize, Serialize};
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct PostMetadata {
pub image_path: String,
pub title: String,
pub date: String,
pub description: String,
pub project_link: String,
}
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct Post {
pub slug : String,
pub metadata: PostMetadata,
pub content: String,
}
cfg_if::cfg_if! {
if #[cfg(feature = "ssr")] {
impl Post {
fn from_content(content: String) -> Option<Self> {
use gray_matter::{Matter, engine::YAML};
let matter = Matter::<YAML>::new();
let post_data = matter
.parse_with_struct::<PostMetadata>(&content)?;
let metadata = post_data.data;
let slug = format!("{}_{}", metadata.date, metadata.title.to_lowercase().replace(' ', "_"));
let content = post_data.content;
use pulldown_cmark::{Parser, Options, html};
let parser = Parser::new_ext(&content, Options::all());
let mut html_output = String::new();
html::push_html(&mut html_output, parser);
Some(Self {
slug,
metadata,
content: html_output,
})
}
fn from_path(path: &std::path::Path) -> Option<Self> {
let content = std::fs::read_to_string(path);
let content = match content {
Ok(content) => content,
Err(e) => {
eprintln!("{:?}", e);
return None;
}
};
Self::from_content(content)
}
pub fn get_all(folder: &str) -> Result<Vec<Self>, String> {
use std::{path::Path, fs::read_dir};
let mut posts: Vec<Self> = Vec::new();
let folder_path = Path::new("markdowns").join(folder);
let paths = read_dir(folder_path).map_err(|e| e.to_string())?;
for path_result in paths {
let path = match path_result {
Ok(path) => path.path(),
Err(e) => {
eprintln!("{:?}", e);
continue;
}
};
if let Some(post) = Self::from_path(&path) {
posts.push(post);
}
}
Ok(posts)
}
}
}
}

View file

@ -0,0 +1,11 @@
use leptos::*;
use super::super::components::{Title, MonParcours};
#[component]
pub fn Experience() -> impl IntoView {
view! {
<main class="m-0 p-0 bg-surface dark:bg-dark_surface text-on_surface dark:text-dark_on_surface">
<Title href="/".to_string() title="Mon parcours".to_string()/>
<MonParcours/>
</main>
}
}

10
src/app/pages/home.rs Normal file
View file

@ -0,0 +1,10 @@
use leptos::*;
use super::super::components::{TopComponent};
#[component]
pub fn Home() -> impl IntoView {
view! {
<main class="m-0 p-0 bg-surface dark:bg-dark_surface text-on_surface dark:text-dark_on_surface">
<TopComponent/>
</main>
}
}

10
src/app/pages/mod.rs Normal file
View file

@ -0,0 +1,10 @@
mod home;
pub use home::Home;
mod posts;
pub use posts::{PostList, PostElement};
mod experience;
pub use experience::Experience;

90
src/app/pages/posts.rs Normal file
View file

@ -0,0 +1,90 @@
use leptos::*;
use leptos_router::*;
use crate::app::{
models::Post,
components::{
Title, Loading
}
};
#[server]
pub async fn get_posts() -> Result<Vec<Post>, ServerFnError> {
let posts = Post::get_all("posts")
.map_err(|e| ServerFnError::ServerError(e.to_string()))?;
Ok(posts)
}
#[server]
pub async fn get_post(
slug: String
) -> Result<Post, ServerFnError> {
let posts = Post::get_all("posts")
.map_err(|e| ServerFnError::ServerError(e.to_string()))?;
let post = posts.into_iter().find(|post| post.slug == slug)
.ok_or(ServerFnError::ServerError("Post not found".to_string()))?;
Ok(post)
}
#[component]
pub fn PostList() -> impl IntoView {
let posts = create_resource(|| (), |_| get_posts());
let posts_view = move || {
posts.and_then(|posts| {
posts.iter()
.map(|post| view! {
<a href=format!("posts/{}", post.slug.clone())>
<img src={post.metadata.image_path.clone()} alt=format!("Image {}", post.metadata.title)/>
<div>
<h2>{post.metadata.title.clone()}</h2>
<p>{post.metadata.description.clone()}</p>
<span>{post.metadata.date.clone()}</span>
</div>
</a>
})
.collect_view()
})
};
view! {
<Suspense fallback=move || view! { <Loading title="Chargement des posts...".to_string() /> }>
<main class="posts">
<Title href="/".to_string() title="Posts".to_string()/>
<div class="posts__cards">{posts_view}</div>
</main>
</Suspense>
}
}
#[component]
pub fn PostElement() -> impl IntoView {
let params = use_params_map();
let slug = move || params.with(|params| params.get("slug").cloned().unwrap_or_default());
let post = create_resource(|| (), move |_| get_post(slug()));
let post_view = move || {
post.and_then(|post| {
view! {
<>
<Title href="/posts".to_string() title=post.metadata.title.clone()/>
<div inner_html={post.content.clone()}></div>
</>
}
})
};
view! {
<Suspense fallback=move || view! { <Loading title="Chargement du post...".to_string() /> }>
<main class="post">
{post_view}
<script>load();</script>
</main>
</Suspense>
}
}

View file

@ -11,7 +11,6 @@ cfg_if! {
#[actix_web::main]
async fn main() -> std::io::Result<()> {
// Setting this to None means we'll be using cargo-leptos and its env vars.
let conf = get_configuration(None).await.unwrap();
@ -25,6 +24,7 @@ cfg_if! {
let site_root = &leptos_options.site_root;
let routes = &routes;
App::new()
.route("/api/{tail:.*}", leptos_actix::handle_server_fns())
.leptos_routes(leptos_options.to_owned(), routes.to_owned(), || view! { <App/> })
.service(Files::new("/", site_root))
.wrap(middleware::Compress::default())

15
style/loading.css Normal file
View file

@ -0,0 +1,15 @@
@layer components {
.loading {
@apply bg-surface dark:bg-dark_surface text-on_surface dark:text-dark_on_surface;
@apply min-h-screen p-5;
@apply flex flex-col justify-center;
& svg {
@apply mx-auto w-12 h-12;
}
& p {
@apply text-center;
}
}
}

28
style/mermaid.css Normal file
View file

@ -0,0 +1,28 @@
@layer components {
.edgeLabel {
@apply !bg-surface dark:!bg-dark_surface !text-on_surface dark:!text-dark_on_surface;
}
.label {
@apply !bg-surface dark:!bg-dark_surface !text-on_surface dark:!text-dark_on_surface;
}
.arrowheadPath {
@apply !fill-surface dark:!fill-dark_surface !stroke-surface dark:!stroke-dark_surface;
}
.path {
@apply !stroke-surface dark:!stroke-dark_surface;
}
.cluster rect,
.node rect,
.node circle,
.node ellipse,
.node polygon,
.node path {
@apply !fill-surface dark:!fill-dark_surface !stroke-surface dark:!stroke-dark_surface;
}
.marker {
@apply !fill-surface dark:!fill-dark_surface !stroke-surface dark:!stroke-dark_surface;
}
.marker.cross {
@apply !stroke-surface dark:!stroke-dark_surface;
}
}

View file

@ -3,8 +3,12 @@
@import "tailwindcss/utilities";
@import './link.css';
@import './loading.css';
@import './project.css';
@import './post.css';
@import './social_links.css';
@import './tag.css';
@import './timeline.css';
@import './top_component.css';
@import './title.css';
@import './top_component.css';
/*@import './mermaid.css';*/

77
style/post.css Normal file
View file

@ -0,0 +1,77 @@
@layer components {
.posts, .post {
@apply bg-surface dark:bg-dark_surface text-on_surface dark:text-dark_on_surface;
@apply min-h-screen p-5;
& h1 {
@apply text-5xl;
}
& h2 {
@apply text-4xl;
}
& h3 {
@apply text-3xl;
}
& h4 {
@apply text-2xl;
}
& h5 {
@apply text-xl;
}
& h6 {
@apply text-lg;
}
& h1, & h2, & h3, & h4, & h5, & h6 {
@apply my-3 font-bold;
}
& p {
@apply text-base my-2;
}
& ul li {
@apply list-disc list-inside;
}
& ol li {
@apply list-decimal list-inside;
}
}
.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;
& > 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;
& > img {
@apply w-full h-48 object-cover;
}
& > div {
@apply p-5 flex flex-col gap-3;
}
}
}
}
.post {
& > div {
@apply mx-auto max-w-3xl;
@apply flex flex-col;
}
& pre > code {
@apply rounded-md my-2;
}
}
}

9
style/title.css Normal file
View file

@ -0,0 +1,9 @@
@layer components {
header {
@apply flex flex-col md:flex-row items-center justify-between p-5;
& h1 {
@apply my-3 font-bold text-center text-6xl mb-5 flex-1;
}
}
}

View file

@ -28,7 +28,15 @@
& > p {
@apply font-normal text-base;
}
}
& .top_component__actions {
@apply flex flex-wrap my-3 gap-5;
& a {
@apply flex-1 h-12 outline outline-2 rounded-md outline-on_surface dark:outline-dark_on_surface p-2 uppercase;
@apply flex items-center justify-center min-w-[150px];
}
}
}
}
}