JohnCoene / waiter

🕰️ Loading screens for Shiny
https://waiter.john-coene.com/
Other
495 stars 25 forks source link

Is it possible to add htmltoolDependency/styles to waiter? #121

Closed rrchai closed 2 years ago

rrchai commented 2 years ago

I am creating a wrapper function for internal use, and I would like to add custom style css on the waiter when the function is called. Here is the minimal example:

/* www/custom.css */
/* let's modify this */
.waiter-overlay.waiter-local {
  left: 0 !important;
} 
# here is the wrapper function
wrapper_fun <- function() {

  w <- waiter_show(
        html = tagList(
          spin_fading_circles(),
          "Loading ..."
        )
      )
  dep <- htmltools::htmlDependency(
      name = "myPack",
      version = "v1",
      package = "myPack",
      src = "www",
      stylesheet = 'custom.css'
    )
 tagList(w, dep)
}

Above will not work, the dependencies will not be added on waiter_show. I wonder if you have better idea how to add some custom styles on the waiter class (such as .waiter-overlay.waiter-local) - using a css file in a function.

rrchai commented 2 years ago

solved by adding the dependency to waiter::use_waiter() in UI:

list(waiter::use_waiter(), dep)