-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from rust-dd/feat/references
feat: add references ui
- Loading branch information
Showing
8 changed files
with
201 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
DEFINE TABLE OVERWRITE reference SCHEMAFULL | ||
PERMISSIONS | ||
FOR select FULL | ||
FOR create, update, delete NONE; | ||
|
||
DEFINE FIELD OVERWRITE title ON reference TYPE string; | ||
DEFINE FIELD OVERWRITE description ON reference TYPE string; | ||
DEFINE FIELD OVERWRITE url ON reference TYPE string; | ||
DEFINE FIELD OVERWRITE tags ON reference TYPE array<string>; | ||
DEFINE FIELD OVERWRITE tech_stack ON reference TYPE array<string>; | ||
DEFINE FIELD OVERWRITE teck_stack_percentage ON reference TYPE array<int>; | ||
DEFINE FIELD OVERWRITE is_published ON reference TYPE bool DEFAULT false; | ||
DEFINE FIELD OVERWRITE created_at ON post TYPE datetime DEFAULT time::now(); | ||
DEFINE FIELD OVERWRITE updated_at ON post TYPE datetime VALUE time::now(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,76 @@ | ||
use crate::ssr::api::select_references; | ||
use leptos::prelude::*; | ||
|
||
#[component] | ||
pub fn Component() -> impl IntoView { | ||
view! { Comming soon... } | ||
let references = | ||
Resource::new_blocking(|| (), move |_| async move { select_references().await }); | ||
|
||
view! { | ||
<div class="container py-12 px-4 mx-auto"> | ||
<section class="mx-auto mb-16 max-w-4xl text-center"> | ||
<h1 class="mb-8 text-5xl font-bold md:text-7xl text-[#ffef5c]"> | ||
Our Project References | ||
</h1> | ||
<p class="mb-8 text-lg text-gray-300 md:text-xl"> | ||
Explore our portfolio of successful projects. We specialize in building high-performance, | ||
reliable systems that make a real impact. | ||
</p> | ||
</section> | ||
<section id="projects" class="mx-auto max-w-5xl"> | ||
<div class="grid gap-8"> | ||
<Suspense fallback=|| ()> | ||
<For | ||
each=move || references.get().and_then(Result::ok).unwrap_or_default() | ||
key=|r| r.id.id.to_string() | ||
let:reference | ||
> | ||
<div class="relative h-[300px] group"> | ||
<div class="absolute inset-0 z-0 rounded-2xl transition-colors duration-500 bg-[#ffef5c]/8 blur-2xl group-hover:bg-[#ffef5c]/10"></div> | ||
<div class="absolute inset-2 z-10 rounded-xl border shadow-lg bg-[#ffef5c]/10 backdrop-blur-xl shadow-[#ffef5c]/5 border-[#ffef5c]/20"></div> | ||
<div class="overflow-hidden absolute inset-2 z-20 rounded-xl border backdrop-blur-2xl bg-white/5 border-white/10"> | ||
<div class="absolute inset-0 bg-[linear-gradient(0deg,transparent_24px,rgba(255,255,255,0.03)_25px),linear-gradient(90deg,transparent_24px,rgba(255,255,255,0.03)_25px)] bg-[size:25px_25px]"></div> | ||
</div> | ||
<div class="flex absolute inset-0 z-30 flex-col px-6 pt-6 pb-10"> | ||
<h3 class="mb-2 text-xl font-bold text-[#ffef5c]"> | ||
{reference.title} | ||
</h3> | ||
<p class="flex-grow mb-4 text-sm text-gray-300"> | ||
{reference.description} | ||
</p> | ||
<div class="grid grid-cols-2 gap-4"> | ||
<For | ||
each=move || { | ||
reference | ||
.tech_stack | ||
.clone() | ||
.into_iter() | ||
.zip(reference.teck_stack_percentage.clone().into_iter()) | ||
.collect::<Vec<_>>() | ||
} | ||
key=|tech| tech.0.to_string() | ||
let:tech | ||
> | ||
<div class="flex justify-between items-center mb-1"> | ||
<span class="text-xs font-medium text-[#ffef5c]"> | ||
{tech.0.to_string()} | ||
</span> | ||
<span class="text-xs text-gray-400">{tech.1}%</span> | ||
</div> | ||
<div class="overflow-hidden h-1.5 rounded-full bg-black/40 backdrop-blur-sm"> | ||
<div | ||
class="h-full bg-gradient-to-r from-[#ffef5c] to-[#ffef5c]" | ||
style=format!("width: {}%", tech.1.min(100)) | ||
></div> | ||
</div> | ||
</For> | ||
</div> | ||
</div> | ||
</div> | ||
</For> | ||
</Suspense> | ||
</div> | ||
</section> | ||
</div> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use surrealdb::sql::Thing; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] | ||
pub struct Author { | ||
pub id: Thing, | ||
pub name: String, | ||
pub email: String, | ||
pub bio: Option<String>, | ||
pub linkedin: Option<String>, | ||
pub twitter: Option<String>, | ||
pub github: Option<String>, | ||
} | ||
|
||
impl Default for Author { | ||
fn default() -> Self { | ||
Self { | ||
id: Thing::from(("author", "0")), | ||
name: String::new(), | ||
email: String::new(), | ||
bio: None, | ||
linkedin: None, | ||
twitter: None, | ||
github: None, | ||
} | ||
} | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] | ||
pub struct Post { | ||
pub id: Thing, | ||
pub title: String, | ||
pub summary: String, | ||
pub body: String, | ||
pub tags: Vec<String>, | ||
pub author: Author, | ||
pub read_time: usize, | ||
pub total_views: usize, | ||
pub slug: Option<String>, | ||
pub created_at: String, | ||
pub updated_at: String, | ||
pub is_published: bool, | ||
pub header_image: Option<String>, | ||
} | ||
|
||
impl Default for Post { | ||
fn default() -> Self { | ||
Self { | ||
id: Thing::from(("post", "0")), | ||
title: String::new(), | ||
summary: String::new(), | ||
body: String::new(), | ||
tags: vec![], | ||
author: Author::default(), | ||
read_time: 0, | ||
total_views: 0, | ||
slug: None, | ||
created_at: String::new(), | ||
updated_at: String::new(), | ||
is_published: true, | ||
header_image: None, | ||
} | ||
} | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] | ||
pub struct Reference { | ||
pub id: Thing, | ||
pub title: String, | ||
pub description: String, | ||
pub url: String, | ||
pub tags: Vec<String>, | ||
pub tech_stack: Vec<String>, | ||
pub teck_stack_percentage: Vec<u8>, | ||
pub created_at: String, | ||
pub updated_at: String, | ||
pub is_published: bool, | ||
} |