Skip to content

Commit

Permalink
ui: adapt to mobile
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Hivert <hivert.is.coming@gmail.com>
  • Loading branch information
ghivert committed May 22, 2024
1 parent 3e03abe commit 391253a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 6 deletions.
2 changes: 1 addition & 1 deletion apps/frontend/src/frontend.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub fn api_endpoint() {

pub fn main() {
let debugger_ = case is_dev() {
False -> Error(Nil)
False | True -> Error(Nil)
True ->
tardis.single("Gloogle")
|> result.nil_error()
Expand Down
21 changes: 20 additions & 1 deletion apps/frontend/src/frontend/view/body/styles.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import gleam/list
import lustre/element
import sketch as s
import sketch/lustre/extra as l
import sketch/size.{px}
import sketch/media
import sketch/size.{px, vw}

pub fn implementations_pill(background, color, attributes, children) {
let id = "implementations-pill-" <> background
Expand Down Expand Up @@ -45,6 +46,10 @@ pub fn search_results_wrapper(attributes, children) {
s.gap(px(24)),
s.grid_template_columns("min-content minmax(auto, 1fr)"),
s.justify_items("center"),
s.media(media.max_width(px(700)), [
s.grid_template_columns("calc(100vw - 48px)"),
s.padding_("0 24px"),
]),
])
}

Expand All @@ -54,6 +59,7 @@ pub fn search_details(attributes, children) {
s.display("flex"),
s.gap(px(12)),
s.justify_content("space-between"),
s.media(media.max_width(px(700)), [s.flex_direction("column")]),
])
}

Expand Down Expand Up @@ -89,6 +95,7 @@ pub fn signature(attributes, children) {
s.white_space("pre-wrap"),
s.display("block"),
s.line_height("1.6"),
s.overflow("auto"),
])
}

Expand Down Expand Up @@ -124,6 +131,15 @@ pub fn search_wrapper(attributes, children) {
s.max_width(px(700)),
s.width(size.percent(100)),
s.margin_("auto"),
s.media(media.max_width(px(700)), [
s.max_width(vw(100)),
s.padding(px(24)),
s.grid_template_areas(
"\"title title title\"
\"input input input\"
\". . submit\"",
),
]),
])
}

Expand Down Expand Up @@ -189,6 +205,7 @@ pub fn matches_titles(attributes, children) {
s.align_items("baseline"),
s.gap(px(6)),
s.font_size(px(12)),
s.media(media.max_width(px(700)), [s.flex_direction("column")]),
])
}

Expand Down Expand Up @@ -251,6 +268,7 @@ pub fn sidebar_wrapper(attributes, children) {
rgba(255, 255, 255, 0)
)"
}),
s.media(media.max_width(px(700)), [s.display("none")]),
])
}

Expand Down Expand Up @@ -311,6 +329,7 @@ pub fn items_wrapper(attributes, children) {
s.gap(px(24)),
s.padding_top(px(12)),
s.max_width(px(700)),
s.width(size.percent(100)),
])
}

Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/frontend/view/footer/styles.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import sketch/lustre/extra as l
import sketch/size.{px}

pub fn footer(attributes, children) {
l.memo("div", attributes, children, [
l.memo("footer", attributes, children, [
s.background(palette.dark.charcoal),
s.display("flex"),
s.flex_direction("column"),
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/frontend/view/navbar/navbar.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub fn navbar(model: Model) {
s.navbar_search([], [
s.navbar_search_title([a.href("/")], [
s.search_lucy([a.src("/images/lucy.svg")]),
h.text("Gloogle"),
s.title([], [h.text("Gloogle")]),
]),
s.search_input_wrapper([e.on_submit(msg.SubmitSearch)], [
search_input.view(model.loading, model.input),
Expand Down
18 changes: 16 additions & 2 deletions apps/frontend/src/frontend/view/navbar/styles.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import frontend/colors/palette
import frontend/view/body/styles as body_styles
import sketch as s
import sketch/lustre/extra as l
import sketch/size.{px}
import sketch/media
import sketch/size.{px, vw}

pub const search_lucy = body_styles.search_lucy

Expand All @@ -25,6 +26,7 @@ pub fn nav_links(attributes, children) {
s.align_items("baseline"),
s.gap(px(48)),
s.padding(px(48)),
s.media(media.max_width(px(700)), [s.display("none")]),
])
}

Expand All @@ -51,7 +53,7 @@ pub fn nav_link(attributes, children) {
}

pub fn navbar(attributes, children) {
l.memo("div", attributes, children, [
l.memo("nav", attributes, children, [
s.position("sticky"),
s.top(px(0)),
s.display("flex"),
Expand All @@ -63,6 +65,13 @@ pub fn navbar(attributes, children) {
s.background(palette.dark.underwater_blue),
s.height(px(130)),
s.z_index(1000),
s.media(media.max_width(px(700)), [
s.padding_left(px(24)),
s.padding_right(px(24)),
s.gap(px(24)),
s.max_width(vw(100)),
s.height(px(115)),
]),
])
}

Expand All @@ -72,5 +81,10 @@ pub fn navbar_search(attributes, children) {
s.gap(px(48)),
s.align_items("center"),
s.flex("1"),
s.media(media.max_width(px(700)), [s.gap(px(24))]),
])
}

pub fn title(a, c) {
l.memo("div", a, c, [s.media(media.max_width(px(700)), [s.display("none")])])
}

0 comments on commit 391253a

Please sign in to comment.