From 7e4db42a8f87a9ec9e21c879b313000568ed7d20 Mon Sep 17 00:00:00 2001 From: Guillaume Hivert Date: Wed, 17 Jul 2024 18:47:01 +0200 Subject: [PATCH] ui: remove show documentation when no documentation --- .../frontend/view/body/search_result.gleam | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/apps/frontend/src/frontend/view/body/search_result.gleam b/apps/frontend/src/frontend/view/body/search_result.gleam index c3353a3..69a77d5 100644 --- a/apps/frontend/src/frontend/view/body/search_result.gleam +++ b/apps/frontend/src/frontend/view/body/search_result.gleam @@ -102,25 +102,29 @@ fn view(model: Model) -> element.Element(Msg) { ), h.div([a.class("external-icon-wrapper")], [icons.external_link()]), ]), - h.button( - [ - a.class("search-details-arrow-expand"), - a.attribute("data-opened", bool.to_string(model.opened)), - e.on_click(ToggleOpen), - ], - [ - h.span([], [ - element.text( - case model.opened { - True -> "Hide" - False -> "Show" - } - <> " documentation", - ), - ]), - icons.arrow(), - ], - ), + case item.documentation, item.metadata.implementations { + "", option.None -> element.none() + _, _ -> + h.button( + [ + a.class("search-details-arrow-expand"), + a.attribute("data-opened", bool.to_string(model.opened)), + e.on_click(ToggleOpen), + ], + [ + h.span([], [ + element.text( + case model.opened { + True -> "Hide" + False -> "Show" + } + <> " documentation", + ), + ]), + icons.arrow(), + ], + ) + }, ]), h.div([a.class("search-body")], [ h.code([a.class("signature")], signature.view_signature(item)),