R/utils_nav.R

Defines functions cs_nav_pad cs_nav_ext_link

Documented in cs_nav_ext_link cs_nav_pad

#' Add a Hyper-linked Item to a Navbar or Navbar Menu
#'
#' @param title The title of the item
#' @param href The URL to link to
#' @param icon An optional icon for the item
#'
#' @return A `bslib::nav_item`
#'
#' @keywords internal
cs_nav_ext_link <- function(title, href, icon = NULL) {
  bslib::nav_item(tags$a(href = href, tags$span(icon, title)))
}

#' Add Padding to a Navbar or Navbar Menu
#'
#' @param width The width of the padding element (a `span`)
#'
#' @return A `tags$span()` element with `style = paste("width:", width)`
#'
#' @keywords internal
cs_nav_pad <- function(width = "1rem") {
  bslib::nav_item(tags$span(style = paste("width:", width)))
}
jesse-smith/covidscreen documentation built on June 15, 2022, 7:46 p.m.