Skip to content

Commit

Permalink
ui: turn navbar transparent on home page for mobile
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Hivert <[email protected]>
  • Loading branch information
ghivert committed May 22, 2024
1 parent b68d300 commit 7793cdf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion apps/frontend/src/frontend/view/navbar/navbar.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ fn navbar_links() {
}

pub fn navbar(model: Model) {
s.navbar([a.class("navbar")], [
let transparent = model.route == router.Home
s.navbar(transparent, [a.class("navbar")], [
case model.route {
router.Home -> h.div([], [])
router.Search(_) | router.Trending ->
Expand Down
11 changes: 8 additions & 3 deletions apps/frontend/src/frontend/view/navbar/styles.gleam
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import frontend/colors/palette
import frontend/view/body/styles as body_styles
import gleam/bool
import sketch as s
import sketch/lustre/extra as l
import sketch/media
Expand Down Expand Up @@ -52,8 +53,9 @@ pub fn nav_link(attributes, children) {
])
}

pub fn navbar(attributes, children) {
l.memo("nav", attributes, children, [
pub fn navbar(transparent: Bool, attributes, children) {
let id = "navbar-transparent-" <> bool.to_string(transparent)
l.dynamic("nav", attributes, children, id, [
s.position("sticky"),
s.top(px(0)),
s.display("flex"),
Expand All @@ -62,7 +64,10 @@ pub fn navbar(attributes, children) {
s.grid_area("navbar"),
s.padding_left(px(48)),
s.gap(px(48)),
s.background(palette.dark.underwater_blue),
s.background(case transparent {
True -> "transparent"
False -> palette.dark.underwater_blue
}),
s.height(px(130)),
s.z_index(1000),
s.media(media.max_width(px(700)), [
Expand Down

0 comments on commit 7793cdf

Please sign in to comment.