Skip to content

Commit

Permalink
feat: add page speed improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
dancixx committed Dec 11, 2024
1 parent ea47dd0 commit 3b1b097
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 6 deletions.
Binary file removed public/rust_color.png
Binary file not shown.
Binary file added public/rust_color.webp
Binary file not shown.
4 changes: 2 additions & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use leptos::prelude::*;
use leptos_meta::*;
use leptos_router::{
components::{FlatRoutes, Route, Router},
ParamSegment, StaticSegment,
ParamSegment, SsrMode, StaticSegment,
};

use crate::{home, post};
Expand Down Expand Up @@ -196,7 +196,7 @@ pub fn App() -> impl IntoView {
outside_errors.insert_with_default_key(AppError::NotFound);
view! { <ErrorTemplate outside_errors /> }.into_view()
}>
<Route path=StaticSegment("") view=home::Component />
<Route path=StaticSegment("") view=home::Component ssr=SsrMode::InOrder />
<Route
path=(StaticSegment("post"), ParamSegment("slug"))
view=post::Component
Expand Down
4 changes: 2 additions & 2 deletions src/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ pub fn Component() -> impl IntoView {
>
<div class="flex flex-col p-3 text-left text-white rounded-lg transition-all duration-500 cursor-pointer break-inside-avoid bg-card hover:text-[#ffef5c]">
<A href=format!("/post/{}", post.slug.as_ref().map_or("", |v| v))>
<div class="flex flex-col gap-1 mb-4">
<p class="text-base font-medium line-clamp-2">{post.title}</p>
<div class="flex flex-col gap-1 mb-4 font-medium">
<p class="text-base line-clamp-2">{post.title}</p>
<p class="italic text-xxs">{post.summary}</p>
</div>
<div class="flex flex-row gap-3 justify-start items-center text-xxs">
Expand Down
2 changes: 1 addition & 1 deletion src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use leptos::prelude::*;
pub fn Component() -> impl IntoView {
view! {
<div class="flex absolute inset-0 flex-col gap-1 justify-center items-center m-auto">
<img src="/rust_color.png" width=32 height=32 class="animate-spin" />
<img src="/rust_color.webp" width=32 height=32 class="animate-spin" />
<p class="text-sm italic text-muted-foreground">Loading...</p>
</div>
}
Expand Down
1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ async fn main() {
use leptos::logging;
use leptos::prelude::*;
use leptos_axum::{generate_route_list, LeptosRoutes};
use std::env;
use tower_http::compression::predicate::{NotForContentType, SizeAbove};
use tower_http::compression::{CompressionLayer, Predicate};
use tower_http::trace::TraceLayer;
Expand Down

0 comments on commit 3b1b097

Please sign in to comment.