Skip to content

Commit

Permalink
feat(fuzzhelp): use CSS to resize TOC instead of JS
Browse files Browse the repository at this point in the history
  • Loading branch information
atusy committed May 5, 2024
1 parent 70c9a60 commit 929056e
Showing 1 changed file with 2 additions and 28 deletions.
30 changes: 2 additions & 28 deletions R/fuzzyhelp.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down

0 comments on commit 929056e

Please sign in to comment.