diff --git a/src/main.rs b/src/main.rs index 70c9b3c..a6121ed 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use agahnim_web_v2::templates::index::home; +use agahnim_web_v2::templates::{index::home, notfound::notfound}; use axum::{Router, routing::get}; use tower_http::services::ServeDir; #[cfg(debug_assertions)] @@ -8,7 +8,8 @@ use tower_livereload::LiveReloadLayer; async fn main() { let app = Router::new() .route("/", get(home)) - .nest_service("/static", ServeDir::new("static")); + .nest_service("/static", ServeDir::new("static")) + .fallback(notfound); // We need to include this flag so that the live reload layer isn't included when the server is built #[cfg(debug_assertions)] diff --git a/src/templates/mod.rs b/src/templates/mod.rs index 33edc95..6685146 100644 --- a/src/templates/mod.rs +++ b/src/templates/mod.rs @@ -1 +1,2 @@ pub mod index; +pub mod notfound; diff --git a/src/templates/notfound.rs b/src/templates/notfound.rs new file mode 100644 index 0000000..f4f4281 --- /dev/null +++ b/src/templates/notfound.rs @@ -0,0 +1,10 @@ +use askama::Template; +use axum::response::{Html, IntoResponse}; + +#[derive(Template)] +#[template(path = "notfound.html")] +struct NotfoundTemplate; + +pub async fn notfound() -> impl IntoResponse { + Html(NotfoundTemplate.render().unwrap()) +} diff --git a/static/assets/images/notfound.webp b/static/assets/images/notfound.webp new file mode 100644 index 0000000..2d4159e Binary files /dev/null and b/static/assets/images/notfound.webp differ diff --git a/static/style.css b/static/style.css index 725de8c..5308bb4 100644 --- a/static/style.css +++ b/static/style.css @@ -80,4 +80,24 @@ home-content { flex-wrap: wrap; justify-content: center; align-items: center; +} + +/* 404 */ +katcenkat { + display: flex; + flex-direction: column; + flex-wrap: wrap; + justify-content: center; + align-items: center; + + img { + transition: opacity 5s ease, transform 5s ease-out; + opacity: 1; + transform: translateY(0px); + + @starting-style { + opacity: 0; + transform: translateY(500px); + } + } } \ No newline at end of file diff --git a/templates/notfound.html b/templates/notfound.html new file mode 100644 index 0000000..c0a7796 --- /dev/null +++ b/templates/notfound.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} + + +{% block content %} + + + + +{% endblock %} \ No newline at end of file