#' @export
renderSkeleton <- function(expr, env = parent.frame(), quoted = FALSE) {
func <- shiny::exprToFunction(expr, env, quoted)
function() {
val <- func()
val
}
}
#' @export
skeletonOutput <- function(id, color = NULL, default = 100, container = shiny::span) {
shiny::addResourcePath(
prefix = "shuny",
directoryPath = fs::path_package("shuny", "www")
)
libs <- shiny::singleton(
tags$head(
tags$script(src = "shuny/js/skeleton.js"),
tags$link(rel = "stylesheet", href = "shuny/css/skeleton.css")
)
)
style <- if (is.null(color)) NULL else paste0("--color: ", color)
shiny::tagList(
libs,
container(
id = id,
class="skeleton",
"data-skeleton" = default,
style = style
)
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.