R/iframe.R

Defines functions iframe_server iframe_ui

Documented in iframe_server iframe_ui

#'
#' iFrame Module UI
#'
#' @description An iframe can be created to display the views and windows hosted on
#' other web pages using a shiny wrapper to accomplish the task in a shiny application
#'
#' @param id is unique ID associated with the button for the UI namespace
#' @param title character. Title of the iframe
#' @param title_container function. A function wrapper for the size of the title
#' @param iframe_description character. Text describing the contents of the iframe
#' @param width number.  A function wrapper for the size of the entire column
#'
#' @return HTML UI code for a shiny application
#'
#' @importFrom shiny column
#' @export


iframe_ui <-
  function(id,
           title = "Requests",
           title_container = shiny::h3,
           iframe_description = "iFrame Description goes here",
           width = 12) {
    ns <- NS(id)
    fluidRow(column(
      width = width,
      title_container(title),
      p(iframe_description),
      htmlOutput(ns("iframe"))
    ))
  }

#'
#' iFrame Module Server
#'
#' @description An iframe can be created to display the views and windows hosted on
#' other web pages using a shiny wrapper to accomplish the task in a shiny application.  This is the server-side function
#'
#' @param input list of inputs used in the shiny application session
#' @param output list of outputs used the shiny application session
#' @param session The shiny app session object
#' @param url character. Link that the iframe should display
#' @param height number.  A function wrapper for height of the iframe
#' @param width number.  A function wrapper for the width of the iframe
#'
#' @return NULL
#' @export

iframe_server <-
  function(input,
           output,
           session,
           url = "https://forms.clickup.com/f/265za-1288/YGT0C8JVTA0ZOBKA1M",
           height = 600,
           width = "100%") {
    output$iframe <- renderUI({
      return(tags$iframe(
        src = url,
        height = height,
        width = width
      ))
    })
  }
HarryRosen/hrimodules documentation built on Jan. 11, 2022, 12:36 a.m.