feat(template): profile template works great :D
This commit is contained in:
parent
436331bc72
commit
5340afbf94
3 changed files with 63 additions and 29 deletions
38
froxy-templates/examples/profile.rs
Normal file
38
froxy-templates/examples/profile.rs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
use froxy_templates::profile::{self};
|
||||
use smol_str::SmolStr;
|
||||
|
||||
/*
|
||||
{
|
||||
friends: std::array::from_fn::<_, 10, _>(|i| Friend {
|
||||
name: "maiboyer".into(),
|
||||
image: "https://friends.42paris.fr/proxy/resize/512/03c61af252becbca11aac5ff49a2e61c/maiboyer.jpg".into(),
|
||||
position: (i < 5).then_some("f1r1s1".into()),
|
||||
last_active: (i > 6).then_some("Last thuesday".into()),
|
||||
}).to_vec(),
|
||||
}
|
||||
*/
|
||||
|
||||
fn main() {
|
||||
let mut env = minijinja::Environment::new();
|
||||
profile::add_to_context(&mut env);
|
||||
let data = profile::render(
|
||||
&env,
|
||||
profile::ProfileData {
|
||||
user: profile::ProfileUser {
|
||||
position: Some(SmolStr::new_static("f1r1s1")),
|
||||
last_active: None,
|
||||
image: "https://friends.42paris.fr/proxy/resize/512/03c61af252becbca11aac5ff49a2e61c/maiboyer.jpg".into(),
|
||||
name: SmolStr::new_static("maiboyer"),
|
||||
pool: None, //Some(SmolStr::new_static("August 2025")),
|
||||
is_friend: false,
|
||||
github: Some("https://github.com/Maix0".to_string()),
|
||||
website: None, //Some("https://maix.me".to_string()),
|
||||
discord: None,// Some("maix".to_string()),
|
||||
recit: Some("Yes".to_string()),
|
||||
},
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
println!("{data}");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue