Skip to content

Commit

Permalink
feat: entry blog of home component created
Browse files Browse the repository at this point in the history
  • Loading branch information
ruizdiazever committed Jun 21, 2024
1 parent 83afbc1 commit 9289098
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 4 deletions.
48 changes: 48 additions & 0 deletions src/components/home/entry.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
use icondata as i;
use leptos::*;
use leptos_icons::*;
use crate::components::common::link::Link;

#[component]
pub fn Entry(
title: String,
description: String,
uri: String,
time: u8,
date: String,
categories: Vec<String>
) -> impl IntoView {
view! {
<div class="flex flex-row items-center h-36 md:h-32 p-4 border border-gray-300
hover:border-gray-400 transition duration-200 ease-out
hover:ease-in rounded-md bg-white shadow-sm hover:shadow-md
transition-shadow relative">

<div class="flex-1 flex flex-col gap-2">
<div class="flex justify-between items-center">
<Link title={title} link={uri} blank={false}/>
<div class="flex items-center gap-2">
<Icon width="1em" height="1em" icon=i::AiClockCircleOutlined />
<span class="text-sm text-muted-foreground">{time} min read</span>
</div>
</div>
<p class="text-sm text-muted-foreground">
{description}
</p>
<div class="flex justify-between items-center mt-2">
<section class="flex gap-2 flex-wrap">
{categories.iter().map(|category| {
view! {
<span class="flex items-center justify-center whitespace-nowrap
rounded-lg bg-gray-100 border border-gray-300 h-6 px-2.5 py-1 text-sm text-gray-700">
{category}
</span>
}
}).collect::<Vec<_>>()}
</section>
<span class="text-sm text-muted-foreground">{date}</span>
</div>
</div>
</div>
}
}
4 changes: 2 additions & 2 deletions src/layouts/components/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ pub fn Header() -> impl IntoView {
<div class="md:flex md:items-center md:gap-12">
<a href="/" class="flex items-center justify-center text-gray-900 hover:text-gray-950 duration-200">
<div class="block items-center justify-center">
<p class="text-xl font-semibold">Ever Ruiz Diaz</p>
<p class="text-md">Rust Developer</p>
<p class="text-2xl font-semibold">Ever Ruiz Diaz</p>
<p class="text-lg">Rust Developer</p>
</div>
</a>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub mod components {
pub mod home {
pub mod experience;
pub mod project_card;
pub mod entry;
}

pub mod common {
Expand Down
37 changes: 35 additions & 2 deletions src/pages/home.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::components::common::values::Icon;
use crate::components::home::{experience::Experience, project_card::Project};
use crate::components::home::entry::Entry;
use crate::layouts::layout::Layout;
use leptos::*;

Expand Down Expand Up @@ -45,6 +46,18 @@ pub fn Home() -> impl IntoView {
Icon::Docker.to_view(),
];

let categories_portfolio = vec![
"Project".to_string(),
"Rust".to_string(),
"Astro".to_string(),
];

let categories_cookies = vec![
"GraphQL".to_string(),
"Rust".to_string(),
"Axum".to_string()
];

view! {
<Layout>
// Childrens
Expand All @@ -53,7 +66,7 @@ pub fn Home() -> impl IntoView {
<br/>
{SUB_DESCRIPTION}
</p>
<h1 class="text-2xl mt-6">Projects</h1>
<h1 class="text-2xl font-medium mt-6">Projects</h1>
<div class="grid gap-4 grid-cols-1 md:grid-cols-2 place-items-center">
<Project
github=false
Expand Down Expand Up @@ -86,7 +99,27 @@ pub fn Home() -> impl IntoView {
{berli_icons}
</Project>
</div>
<h1 class="text-2xl mt-6">Experience</h1>

// Blog
<h1 class="text-2xl font-medium mt-6">Blog</h1>
<Entry
title="Portfolio WASM".to_string()
description="My new portfolio WASM powered by Rust with Leptos".to_string()
uri="/blog/portfolio".to_string()
time=5
date="Jun 20, 2024".to_string()
categories=categories_portfolio
/>
<Entry
title="Cookies with GraphQL in Rust".to_string()
description="Learn best practices and enhance the security of your GraphQL interface in Rust".to_string()
uri="/blog/portfolio".to_string()
time=5
date="Jun 20, 2024".to_string()
categories=categories_cookies
/>

<h1 class="text-2xl font-medium mt-6">Experience</h1>
<div class="relative flex flex-col gap-4">
<div class="after:absolute after:inset-y-0 after:w-px after:bg-gray-500/20 relative pl-6 after:left-0 grid gap-10">
<Experience
Expand Down

0 comments on commit 9289098

Please # to comment.