Added personal picture and added Author component
Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
This commit is contained in:
@@ -60,6 +60,7 @@ fn Publications() -> Element {
|
||||
}
|
||||
}
|
||||
fn Publication(prop: PublicationProp) -> Element {
|
||||
let pattern = "T.-D. Tran";
|
||||
rsx! {
|
||||
Link {
|
||||
class:"block max-w-sm p-6 bg-white border border-gray-200 rounded-lg shadow hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700",
|
||||
@@ -71,8 +72,11 @@ fn Publication(prop: PublicationProp) -> Element {
|
||||
},
|
||||
span { class: "text-lg text-gray-900 dark:text-white", "{prop.conference}" },
|
||||
p {
|
||||
class:"font-normal text-gray-700 dark:text-gray-400",
|
||||
"{prop.authors}",
|
||||
class:"font-normal text-gray-700 dark:text-gray-400 italic",
|
||||
Authors {
|
||||
authors: "{prop.authors}",
|
||||
pattern: "{pattern}",
|
||||
},
|
||||
}
|
||||
p {
|
||||
class:"font-normal text-gray-700 dark:text-gray-400",
|
||||
@@ -125,6 +129,8 @@ struct ProjectProp {
|
||||
}
|
||||
|
||||
fn Project(prop: ProjectProp) -> Element {
|
||||
let pattern = "T.-D. Tran";
|
||||
|
||||
rsx! {
|
||||
Link {
|
||||
class:"block max-w-sm p-6 bg-white border border-gray-200 rounded-lg shadow hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700",
|
||||
@@ -137,7 +143,10 @@ fn Project(prop: ProjectProp) -> Element {
|
||||
p { class: "text-lg text-gray-900 dark:text-white", "{prop.kind}" },
|
||||
p {
|
||||
class:"font-normal text-gray-700 dark:text-gray-400",
|
||||
"{prop.authors}",
|
||||
Authors {
|
||||
authors: "{prop.authors}",
|
||||
pattern: "{pattern}",
|
||||
},
|
||||
}
|
||||
p {
|
||||
class:"font-normal text-gray-700 dark:text-gray-400",
|
||||
@@ -146,3 +155,23 @@ fn Project(prop: ProjectProp) -> Element {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Props)]
|
||||
struct AuthorProp {
|
||||
authors: String,
|
||||
pattern: String,
|
||||
}
|
||||
|
||||
fn Authors(prop: AuthorProp) -> Element {
|
||||
if let Some(start) = prop.authors.find(&prop.pattern) {
|
||||
let end = start + prop.pattern.len();
|
||||
let left = &prop.authors[..start];
|
||||
let middle = &prop.authors[start..end];
|
||||
let right = &prop.authors[end..];
|
||||
rsx! {
|
||||
"{left}" , b { "{middle}" }, "{right}",
|
||||
}
|
||||
} else {
|
||||
rsx! { "{prop.authors}" }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user