Skip to content

Commit

Permalink
Merge pull request #13 from ghivert/fix/mobile-ui
Browse files Browse the repository at this point in the history
Hide sidebar on mobile & footer search on desktop
  • Loading branch information
ghivert authored Aug 3, 2024
2 parents 151f495 + cad6ca0 commit ec5ce83
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
2 changes: 1 addition & 1 deletion apps/frontend/src/frontend/view.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fn layout(attributes, children) {

fn navbar(model: Model) {
case model.route {
router.Home | router.Search(_) -> navbar.navbar(model)
router.Search(_) -> navbar.navbar(model)
_ -> el.none()
}
}
Expand Down
2 changes: 2 additions & 0 deletions apps/frontend/src/frontend/view/body/body.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import frontend/images
import frontend/router
import frontend/strings as frontend_strings
import frontend/view/search_input/search_input
import gleam/bool
import gleam/dict
import gleam/result
import gleam/string
Expand Down Expand Up @@ -131,6 +132,7 @@ pub fn view_trending(model: Model) {
}

fn sidebar(model: Model) {
use <- bool.guard(when: model.is_mobile, return: el.none())
h.main([a.class("search-sidebar")], [
h.a([a.class("sidebar-title"), a.href("/")], [
h.img([
Expand Down
3 changes: 3 additions & 0 deletions apps/frontend/src/frontend/view/footer/footer.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import data/msg
import frontend/view/footer/links.{links}
import frontend/view/footer/styles as s
import frontend/view/search_input/search_input
import gleam/bool
import gleam/list
import lustre/attribute as a
import lustre/element as el
import lustre/element/html as h
import lustre/event as e

Expand All @@ -25,6 +27,7 @@ pub fn view() {
}

pub fn search_bar(model: Model) {
use <- bool.guard(when: !model.is_mobile, return: el.none())
h.div([a.class("footer-search")], [
h.form([e.on_submit(msg.SubmitSearch)], [
search_input.view(model.loading, model.input, small: True),
Expand Down
12 changes: 0 additions & 12 deletions apps/frontend/src/stylesheets/all.css
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,6 @@ lazy-node:has(:not(:defined)) {
top: 0px;
}

@media (max-width: 700px) {
.search-sidebar {
display: none;
}
}

.sidebar-title {
display: flex;
align-items: center;
Expand Down Expand Up @@ -549,12 +543,6 @@ lazy-node:has(:not(:defined)) {
margin-top: 24px;
}

@media (min-width: 700px) {
.footer-search {
display: none;
}
}

.search-result-empty-callout {
border: 1px solid var(--border-color);
padding: 12px;
Expand Down

0 comments on commit ec5ce83

Please sign in to comment.