Fix tags + add elements

This commit is contained in:
Florian RICHER 2023-10-12 09:10:17 +02:00
parent f4dba8213d
commit 807b6c2735
3 changed files with 81 additions and 21 deletions

View file

@ -16,7 +16,7 @@ pub use top_component::TopComponent;
mod project;
pub use project::{ProjectContainer, Project};
pub use project::{ProjectList, ProjectElement};
mod timeline;

View file

@ -1,5 +1,3 @@
use std::collections::HashMap;
use std::rc::Rc;
use leptos::*;
use super::{
@ -10,12 +8,11 @@ use super::{
TimelineCard,
TimelineCardSummary,
TimelineCardTag,
TimelineCardContent
TimelineCardContent,
ProjectList,
ProjectElement
};
// Lang
// const CPP_TAG = <Tag name="C++" url="https://isocpp.org/" />
//
// // Other
// const REACT_TAG = <Tag name="React" url="https://fr.legacy.reactjs.org/" />
// const SYMFONY_4_TAG = <Tag name="Symfony" url="https://symfony.com/" />
@ -42,19 +39,59 @@ use super::{
// const ROCKET_RS_TAG = <Tag name="Rocket" url="https://rocket.rs/" />
// const ACTIX_WEB_TAG = <Tag name="Actix Web" url="https://actix.rs/" />
#[derive(Copy, Clone)]
struct Lang<'a> {
pub lang : &'a str,
pub url : &'a str,
}
impl<'a> IntoView for Lang<'a> {
fn into_view(self) -> View {
let url = self.url.to_string();
let lang = self.lang.to_string();
view! {
<Tag url=url>
{ lang }
</Tag>
}
}
}
// Lang
const RUST_TAG : Lang<'static> = Lang { lang: "Rust", url: "https://www.rust-lang.org/" };
const JAVA_TAG : Lang<'static> = Lang { lang: "Java", url: "https://www.java.com/fr/" };
const CPP_TAG : Lang<'static> = Lang { lang: "C++", url: "https://isocpp.org/" };
// Other
const REACT_TAG : Lang<'static> = Lang { lang: "React", url: "https://fr.legacy.reactjs.org/" };
const SYMFONY_4_TAG : Lang<'static> = Lang { lang: "Symfony", url: "https://symfony.com/" };
const FLUTTER_TAG : Lang<'static> = Lang { lang: "Flutter", url: "https://flutter.dev/" };
const RUBY_ON_RAILS_TAG : Lang<'static> = Lang { lang: "Ruby on rails", url: "https://rubyonrails.org/" };
const HOTWIRED_TAG : Lang<'static> = Lang { lang: "Hotwired", url: "https://hotwired.dev/" };
const DOCKER_TAG : Lang<'static> = Lang { lang: "Docker", url: "https://www.docker.com/" };
const STEAM_TAG : Lang<'static> = Lang { lang: "Steam API", url: "https://partner.steamgames.com/doc/sdk/api/example" };
const GITLAB_CI_TAG : Lang<'static> = Lang { lang: "Gitlab CI", url: "https://docs.gitlab.com/ee/ci/" };
const UNITY_TAG : Lang<'static> = Lang { lang: "Unity 3D", url: "https://unity.com/fr" };
const WORDPRESS_TAG : Lang<'static> = Lang { lang: "Wordpress", url: "https://wordpress.com/fr/" };
const CORDOVA_TAG : Lang<'static> = Lang { lang: "Cordova", url: "https://cordova.apache.org/" };
const ELECTRON_TAG : Lang<'static> = Lang { lang: "Electron", url: "https://www.electronjs.org/" };
const LWJGL_TAG : Lang<'static> = Lang { lang: "LWJGL", url: "https://www.lwjgl.org/" };
const OPENGL_TAG : Lang<'static> = Lang { lang: "OpenGL", url: "https://www.opengl.org/" };
const VULKAN_TAG : Lang<'static> = Lang { lang: "Vulkan", url: "https://www.vulkan.org/" };
const MIDI_TAG : Lang<'static> = Lang { lang: "MIDI", url: "https://fr.wikipedia.org/wiki/Musical_Instrument_Digital_Interface" };
const REQUIREJS_TAG : Lang<'static> = Lang { lang: "RequireJS", url: "https://requirejs.org/" };
const WEBPACK_TAG : Lang<'static> = Lang { lang: "Webpack", url: "https://webpack.js.org/" };
const VITE_TAG : Lang<'static> = Lang { lang: "Vite", url: "https://vitejs.dev/" };
const MAVEN_TAG : Lang<'static> = Lang { lang: "Maven", url: "https://maven.apache.org/" };
const GRADLE_TAG : Lang<'static> = Lang { lang: "Gradle", url: "https://gradle.org/" };
const BABYLONJS_TAG : Lang<'static> = Lang { lang: "BabylonJS", url: "https://www.babylonjs.com/" };
const ROCKET_RS_TAG : Lang<'static> = Lang { lang: "Rocket", url: "https://rocket.rs/" };
const ACTIX_WEB_TAG : Lang<'static> = Lang { lang: "Actix Web", url: "https://actix.rs/" };
const LEPTOS_TAG : Lang<'static> = Lang { lang: "Leptos", url: "https://leptos.dev/" };
#[component]
pub fn MonParcours() -> impl IntoView {
let tools = Rc::from(HashMap::from([
("Rust", "https://www.rust-lang.org/"),
("Java", "https://www.java.com/fr/"),
("C++", "https://isocpp.org/")
]));
let to_tag = |tools: &HashMap<&str, &str>, lang: &str| {
let url = tools.get(lang).unwrap_or(&"");
view! { <Tag url=url.to_string()>Rust</Tag> }
};
view! {
<div>
<Timeline>
@ -62,7 +99,15 @@ pub fn MonParcours() -> impl IntoView {
<TimelineLabel slot:labels>r"2019 - Aujourdhui"</TimelineLabel>
<TimelineCard slot:cards>
<TimelineCardSummary slot:titles>
<TimelineCardTag slot:tags>{ to_tag(tools.as_ref(), "Rust") }</TimelineCardTag>
<TimelineCardTag slot:tags>{ REACT_TAG }</TimelineCardTag>
<TimelineCardTag slot:tags>{ SYMFONY_4_TAG }</TimelineCardTag>
<TimelineCardTag slot:tags>{ FLUTTER_TAG }</TimelineCardTag>
<TimelineCardTag slot:tags>{ RUBY_ON_RAILS_TAG }</TimelineCardTag>
<TimelineCardTag slot:tags>{ HOTWIRED_TAG }</TimelineCardTag>
<TimelineCardTag slot:tags>{ RUST_TAG }</TimelineCardTag>
<TimelineCardTag slot:tags>{ WEBPACK_TAG }</TimelineCardTag>
<TimelineCardTag slot:tags>{ VITE_TAG }</TimelineCardTag>
<TimelineCardTag slot:tags>{ GRADLE_TAG }</TimelineCardTag>
r"Développeur dapplication Web, Mobile et Système (CDI)"
</TimelineCardSummary>
<TimelineCardContent slot:cards>
@ -73,6 +118,21 @@ pub fn MonParcours() -> impl IntoView {
<i>11 Septembre 2019 - Toujours en CDI</i>
</TimelineCardContent>
</TimelineCard>
<TimelineCard slot:cards>
<TimelineCardSummary slot:titles>
<TimelineCardTag slot:tags>{ RUST_TAG }</TimelineCardTag>
<TimelineCardTag slot:tags>{ VULKAN_TAG }</TimelineCardTag>
r"Développement 3D (Perso)"
</TimelineCardSummary>
<TimelineCardContent slot:cards>
<p>Je développe un petit moteur 3D pour apprendre à utiliser Vulkan, mais aussi pour prendre en expérience en Rust</p><br/>
<ProjectList>
<ProjectElement url="https://github.com/mrdev023/RustGameMicroEngine".to_string()>Projet pour apprendre</ProjectElement>
<ProjectElement url="https://github.com/mrdev023/voxel_rust_test".to_string()>Le but, refaire mon vieux projet de voxel pour progresser en Rust et Vulkan</ProjectElement>
</ProjectList>
</TimelineCardContent>
</TimelineCard>
</TimelineElement>
</Timeline>
</div>

View file

@ -1,7 +1,7 @@
use leptos::*;
#[component]
pub fn ProjectContainer(
pub fn ProjectList(
children: Children
) -> impl IntoView {
view! {
@ -12,7 +12,7 @@ pub fn ProjectContainer(
}
#[component]
pub fn Project(
pub fn ProjectElement(
children: Children,
#[prop(optional)]
image_src: Option<String>,