From 8e4800ae8cf62095bbe05c702e57196292f75fec Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Mon, 9 Oct 2023 19:56:06 +0200 Subject: [PATCH] Update --- Cargo.toml | 1 + src/app/components/link.rs | 4 ++-- src/app/components/mod.rs | 5 ++++- src/app/components/project.rs | 14 ++++++-------- src/app/components/social_link.rs | 3 ++- src/app/components/timeline.rs | 24 +++++++++++++++++++++++- 6 files changed, 38 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7b88d1f..811d427 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,6 +23,7 @@ leptos_icons = { version = "0.1.0", features = [ "FaGithubBrands", "FaLinkedinBrands", "FaEnvelopeSolid", + "FaCaretDownSolid" ]} # dependecies for client (enable when csr or hydrate set) diff --git a/src/app/components/link.rs b/src/app/components/link.rs index 4032b6f..10ab4c4 100644 --- a/src/app/components/link.rs +++ b/src/app/components/link.rs @@ -4,8 +4,8 @@ use leptos_icons::*; #[component] pub fn Link( - #[prop[optional]] - url: String, + #[prop(optional)] + url: Option, children: Children ) -> impl IntoView { view! { diff --git a/src/app/components/mod.rs b/src/app/components/mod.rs index f38c67e..96f9852 100644 --- a/src/app/components/mod.rs +++ b/src/app/components/mod.rs @@ -11,4 +11,7 @@ mod top_component; pub use top_component::TopComponent; mod project; -pub use project::{ProjectContainer, Project}; \ No newline at end of file +pub use project::{ProjectContainer, Project}; + +mod timeline; +pub use timeline::{Timeline}; \ No newline at end of file diff --git a/src/app/components/project.rs b/src/app/components/project.rs index 3b61e9a..c30d73c 100644 --- a/src/app/components/project.rs +++ b/src/app/components/project.rs @@ -14,17 +14,15 @@ pub fn ProjectContainer( #[component] pub fn Project( children: Children, - image_src: String, - url: String + #[prop(optional)] + image_src: Option, + #[prop(optional)] + url: Option ) -> impl IntoView { view! { - { if !image_src.is_empty() { - Some(view! { }) - } else { - None - }} -

{children()}

+ { image_src.map(|src| view! { }) } +

{ children() }

} } \ No newline at end of file diff --git a/src/app/components/social_link.rs b/src/app/components/social_link.rs index 93a3ffe..7df2dc7 100644 --- a/src/app/components/social_link.rs +++ b/src/app/components/social_link.rs @@ -15,7 +15,8 @@ pub fn SocialLinkContainer( #[component] pub fn SocialLink( children: Children, - url: String, + #[prop(optional)] + url: Option, icon: Icon, ) -> impl IntoView { view! { diff --git a/src/app/components/timeline.rs b/src/app/components/timeline.rs index 2147f99..48f4cc7 100644 --- a/src/app/components/timeline.rs +++ b/src/app/components/timeline.rs @@ -1,4 +1,6 @@ use leptos::*; +use leptos_icons::FaIcon::FaCaretDownSolid; +use leptos_icons::*; #[component] pub fn Timeline( @@ -6,9 +8,29 @@ pub fn Timeline( ) -> impl IntoView { view! {
-
    +
      { children() }
} +} + +#[component] +pub fn TimelineCard( + titles: F, + children: Children, +) -> impl IntoView + where + F: Fn() -> IV, + IV: IntoView, +{ + view! { +
+ + { titles() } + + +
{ children() }
+
+ } } \ No newline at end of file