R/juicyMeta.R

#' @import htmltools
NULL

#' Meta class for juicystat
#'
#' Meta class for juicystat
#' @export

juicyMetaLab <- function(x){
  as.character(
    withTags(
      div(class="post-meta clearfix",
            span(x)
      )
    )
  )
}

#' @import htmltools
NULL

#' Update label class for juicystat
#'
#' Update label for juicystat
#' @export

juicyUpdateLab <- function(x){
  as.character(
    withTags(
      div(class="update-label", span(x) )
    )
  )
}


#' @import htmltools
NULL

#' Puts html into specified div
#'
#' Puts html into specified div
#' @examples
#' juicyInDiv("elo")
#' juicyInDiv("elo", class="title", object="h1")
#' @export

juicyInDiv <- function(x, class, object="div"){

  if(!missing(class)){
    div <- sprintf('<%1$s class="%2$s">%3$s</%1$s>', object, class, x)
  } else {
    div <- sprintf('<%1$s> %2$s </%1$s>', object, x)
  }

  div

}


#' @import htmltools
NULL

#' Generates tooltip for juicystat
#'
#' Generates tooltip for juicystat
#' @examples
#'  juicyTooltip("
#'    Summed distance form all trips between events",
#'    "Top Travellers (2017)",
#'    "h3"
#'  )
#' @export

juicyTooltip <- function(tooltip, text, object="div"){
  sprintf({'<%1s data-balloon="%2$s" data-balloon-pos="down">%3$s</%1$s>'}, object, tooltip , text)
}
elo2zero/juicystat.vis documentation built on May 31, 2019, 8:06 a.m.