R/utils_exercice.R

Defines functions show_data exercice

Documented in exercice

# [exercices] utils functions

#' exercice
#'
#' @param title id and title of the exercice
#' @param info path to markdown to introduce exercice
#' @param data data to practice
#'
#' @importFrom shiny tagList icon uiOutput
#' @importFrom DT DTOutput
exercice <- function(title, info, data) {
  div(
    id = paste0(title, " exercice"),
    class = "exercice",
    tags$div(
      class = "main-title",
      h1(title),
      a("data-card" = title, span())
    ),
    info_section(file = info),
    div(
      class = "title",
      icon('search'),
      h5("Discover data")
    ),
    DTOutput(data)
    #lapply(names(data), function(table) show_data(data[[table]], table))
  )
}

show_data <- function(outputId, name) {
  div(
    class = "data",
    div(
      class = "title",
      icon("table"),
      h6(name)
    ),
    DTOutput(outputId)
  )
}
ArthurData/sqlnstructor documentation built on Dec. 17, 2021, 9:44 a.m.