From 929056ea475694b8c1fdd90749960944eccb05af Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Sun, 5 May 2024 00:05:06 +0900 Subject: [PATCH 1/4] feat(fuzzhelp): use CSS to resize TOC instead of JS --- R/fuzzyhelp.R | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/R/fuzzyhelp.R b/R/fuzzyhelp.R index bcd4bb3..fafa217 100644 --- a/R/fuzzyhelp.R +++ b/R/fuzzyhelp.R @@ -282,37 +282,11 @@ create_ui <- function(query = "", background = FALSE) { width = "100%" ), reactable::reactableOutput("tocViewer", width = "100%", height = "200px"), - htmltools::tags$div( - id = "bar", - style = paste( - "width: 100%; height: 8px; cursor: row-resize;", - "background-color: transparent;" - ), - draggable = "true" - ), shiny::uiOutput("helpViewer"), - style = "display: grid; grid-template-rows: auto auto auto 1fr" + style = "display: grid; grid-template-rows: auto auto 1fr" ), htmltools::tags$style(" - #tocViewer { - overflow: hidden; - } - "), - htmltools::tags$script(" - (function(){ - // Resize tocViewer - const toc = document.getElementById('tocViewer'); - const bar = document.getElementById('bar'); - let screenY, tocHeight - bar.addEventListener('dragstart', function() { - screenY = window.event.screenY; - tocHeight = toc.getBoundingClientRect().height; - }); - bar.addEventListener('drag', function() { - const diff = window.event.screenY - screenY; - toc.style.height = tocHeight + diff + 'px'; - }); - })(); + #tocViewer { overflow: hidden; resize: vertical; margin-bottom: 15px } "), style = "display: grid; grid-template-rows: auto 1fr; height: 100vh" ) From 42c32f951090fa218342d4e576a8478a0b32939a Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Sun, 5 May 2024 00:06:45 +0900 Subject: [PATCH 2/4] feat(fuzzyhelp): increase height of help viewer by moving label of search query input to placeholder --- R/fuzzyhelp.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/fuzzyhelp.R b/R/fuzzyhelp.R index fafa217..f4faf32 100644 --- a/R/fuzzyhelp.R +++ b/R/fuzzyhelp.R @@ -277,7 +277,8 @@ create_ui <- function(query = "", background = FALSE) { miniUI::miniContentPanel( shiny::textInput( "query", - label = "Search query", + label = NULL, + placeholder = "Search query", value = paste(query, collapse = " "), width = "100%" ), From 87b8fbbdcf7f8b968db6ccbee58272d7717e1406 Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Sun, 5 May 2024 20:46:37 +0900 Subject: [PATCH 3/4] feat(fuzzhelp): improve interaction with TOC --- R/fuzzyhelp.R | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/R/fuzzyhelp.R b/R/fuzzyhelp.R index f4faf32..82895a8 100644 --- a/R/fuzzyhelp.R +++ b/R/fuzzyhelp.R @@ -325,7 +325,14 @@ create_server <- function( defaultPageSize = 20, selection = "single", defaultSelected = if (nrow(toc_matched) != 0) 1L, - onClick = "select" + onClick = "select", + striped = TRUE, + highlight = TRUE, + theme = reactable::reactableTheme( + cellPadding = "2px", + style = list(fontSize = "0.9em"), + highlight = "beige" + ) ) })) reactiveSelection <- shiny::reactive({ From a1734dc93409d75e74da66a868cf0beed1b10eb8 Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Sun, 5 May 2024 21:03:57 +0900 Subject: [PATCH 4/4] docs(NEWS): improved shiny UI of `fuzzyhelp()` --- NEWS.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index c5b5e3c..09e9ed9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,11 @@ -# felp 0.5.1 - -- Fixed `fuzzyhelp()` not showing preview on RStudio Server. +# felp 0.6.0 + +- Fixed `fuzzyhelp()` not showing preview on RStudio Server (#23). +- Remove **covr** and **rmarkdown** from suggests (#24). +- Improved Shiny UI of `fuzzyhelp()` (#25) + - resize with CSS instead of JS so that resize works properly on Chrome and Firefox + - increase height of help viewer + - theming TOC to be striped, be dense, and to highlight hovered-row # felp 0.5.0