💻 My personal website blog.kacaii.dev/
blog gleam lustre

:lipstick: add `back` button to posts

+17 -8
+3 -4
priv/posts/building-my-college-project-with-gleam.md
··· 98 98 } 99 99 ``` 100 100 101 - Since I'm using the *[]{.nf .nf-dev-erlang .text-ctp-red}* erlang compilation target, 102 - It allows me to set up a *process supervisor* to watch for potential crashes. 103 - No need to worry about the application going down because your intern 104 - vibe coded one of the endpoints. 101 + Since I'm using the erlang compilation target, It allows me to set up 102 + a *process supervisor* to watch for potential crashes. No need to worry about 103 + the application going down because your intern vibe coded one of the endpoints. 105 104 106 105 ```gleam 107 106 pub fn handle_request(
+12 -1
src/blog/page/content.gleam
··· 6 6 import gleam/list 7 7 import gleam/option 8 8 import jot 9 - import lustre/attribute.{class} 9 + import lustre/attribute.{class} as attr 10 10 import lustre/element 11 11 import lustre/element/html 12 12 import web ··· 25 25 html.hr([class("border text-ctp-surface0")]), 26 26 ]) 27 27 28 + let back_button_style = 29 + class( 30 + "mx-auto w-full text-right underline underline-offset-2 text-ctp-lavender", 31 + ) 32 + 33 + let back_button = 34 + html.a([attr.href("/posts"), back_button_style], [ 35 + html.text("Back"), 36 + ]) 37 + 28 38 root.view(title:, content: [ 29 39 navbar.view([]), 30 40 post_header, 31 41 view(post), 42 + back_button, 32 43 footer.view(), 33 44 ]) 34 45 }
+2 -3
src/blog/page/navbar.gleam
··· 3 3 import lustre/element/html 4 4 5 5 pub fn view(attributes: List(attr.Attribute(_))) { 6 - let style = 7 - class("flex gap-6 justify-center mx-auto w-full" <> " sm:gap-2.5 md:gap-8") 6 + let style = class("grid grid-cols-4 place-items-center") 8 7 9 8 html.nav([style, ..attributes], [ 10 9 route(icon: "nf-fa-home", href: "/", label: "Home"), ··· 19 18 let anchor_style = class("flex gap-2 items-center") 20 19 21 20 html.a([anchor_style, attr.href(to)], [ 22 - nerd_font_icon.view([class("hidden sm:inline-block")], nf), 21 + nerd_font_icon.view([class("hidden md:inline-block")], nf), 23 22 html.p([text_style], [html.text(text)]), 24 23 ]) 25 24 }