R/mod_card_links.R

Defines functions mod_card_links_server mod_card_links_ui

#' UI Card Links
#' 
#' @param id The namespace identifier.
#' @noRd
#' 
mod_card_links_ui <- function(id) {
  
  ns <- shiny::NS(id)
  
  shiny::uiOutput(ns("links"))
  
}

#' Server Card Links
#'
#' @param id The namespace identifier.
#' @param company Data about the company.
#' @noRd
#' 
mod_card_links_server <- function(id, company) {
  
  shiny::moduleServer(
    id,
    function(input, output, session) {
      
      output$links <-
        shiny::renderUI(
          bs4Dash::box(
            width = 12,
            title = "Links",
            collapsible = FALSE,
            closable = FALSE,
            shiny::a(href = company$links$website, "SpaceX"),
            shiny::br(),
            shiny::a(href = company$links$flickr, "Flickr"),
            shiny::br(),
            shiny::a(href = company$links$twitter, "Twitter"),
            shiny::br(),
            shiny::a(href = company$links$elon_twitter, "Elon Musk Twitter")
          )
        )
    
    }
  )
  
}
James-G-Hill/SpaceX-R-Shiny-Application documentation built on Nov. 11, 2021, 11:26 p.m.