💻 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 } 99 ``` 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. 105 106 ```gleam 107 pub fn handle_request(
··· 98 } 99 ``` 100 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. 104 105 ```gleam 106 pub fn handle_request(
+12 -1
src/blog/page/content.gleam
··· 6 import gleam/list 7 import gleam/option 8 import jot 9 - import lustre/attribute.{class} 10 import lustre/element 11 import lustre/element/html 12 import web ··· 25 html.hr([class("border text-ctp-surface0")]), 26 ]) 27 28 root.view(title:, content: [ 29 navbar.view([]), 30 post_header, 31 view(post), 32 footer.view(), 33 ]) 34 }
··· 6 import gleam/list 7 import gleam/option 8 import jot 9 + import lustre/attribute.{class} as attr 10 import lustre/element 11 import lustre/element/html 12 import web ··· 25 html.hr([class("border text-ctp-surface0")]), 26 ]) 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 + 38 root.view(title:, content: [ 39 navbar.view([]), 40 post_header, 41 view(post), 42 + back_button, 43 footer.view(), 44 ]) 45 }
+2 -3
src/blog/page/navbar.gleam
··· 3 import lustre/element/html 4 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") 8 9 html.nav([style, ..attributes], [ 10 route(icon: "nf-fa-home", href: "/", label: "Home"), ··· 19 let anchor_style = class("flex gap-2 items-center") 20 21 html.a([anchor_style, attr.href(to)], [ 22 - nerd_font_icon.view([class("hidden sm:inline-block")], nf), 23 html.p([text_style], [html.text(text)]), 24 ]) 25 }
··· 3 import lustre/element/html 4 5 pub fn view(attributes: List(attr.Attribute(_))) { 6 + let style = class("grid grid-cols-4 place-items-center") 7 8 html.nav([style, ..attributes], [ 9 route(icon: "nf-fa-home", href: "/", label: "Home"), ··· 18 let anchor_style = class("flex gap-2 items-center") 19 20 html.a([anchor_style, attr.href(to)], [ 21 + nerd_font_icon.view([class("hidden md:inline-block")], nf), 22 html.p([text_style], [html.text(text)]), 23 ]) 24 }