R/utils_sections.R

Defines functions news_section warning_section info_section learning_section section

Documented in info_section learning_section news_section section warning_section

# [sections] utils functions

#' section
#'
#' @param class section class
#' @param icon icon to print
#' @param path path to material
#' @param file material
#'
#' @importFrom shiny div icon includeMarkdown
section <- function(class, icon, path, file) {
  div(
    class = class,
    icon(icon),
    column(
      width = 12,
      includeMarkdown(
        path = file.path(
          system.file(path, package = 'sqlnstructor'),
          file
        )
      )
    )
  )
}

#' learning_section
#'
#' @seealso section()
#'
#' @param file material to learn
learning_section <- function(file) {
  section(
    class = "learning-section",
    icon = "graduation-cap",
    path = "app/www/materials/learn",
    file = file
  )
}

#' info_section
#'
#' @seealso section()
#'
#' @param file material to info
#' @importFrom shiny div icon includeMarkdown
info_section <- function(file) {
  section(
    class = "info-section",
    icon = "info-circle",
    path = "app/www/materials",
    file = file
  )
}

#' warning_section
#'
#' @seealso section()
#'
#' @param file material to info
#' @importFrom shiny div icon includeMarkdown
warning_section <- function(file) {
  section(
    class = "warning-section",
    icon = "exclamation-circle",
    path = "app/www/materials",
    file = file
  )
}

#' news_section
#'
#' @seealso section()
#'
#' @param file news to info
#' @importFrom shiny div icon includeMarkdown
news_section <- function(file) {
  section(
    class = "news-section",
    icon = "",
    path = "app/www/materials/news",
    file = file
  )
}
ArthurData/sqlnstructor documentation built on Dec. 17, 2021, 9:44 a.m.