I am trying to package a Shiny module that displays a modal with a logo (in png format). For this purpose, I have created a "inst/www" directory to store the logo file. The directory tree looks something like this:
├─ DESCRIPTION
├─ inst
│ └── www
│ └── logo.png
├── man
│ └── test.Rd
├── NAMESPACE
├── packagetest.Rproj
└── R
└── test.R
However, after building and installing, the package doesn't seem to read from the predefined directory where I put my "logo.png". Instead, it reads from the main project where I inserted the function from the package. The testUI() function of the package is something like this:
testUI <- function(id) {
ns <- NS(id)
shiny::showModal(
modalDialog(
title = img(src="inst/www/logo.png", style="display:block; margin-left:auto; margin-right:auto;"),
br(),
fluidRow(
column(6, align="center", offset = 3,
textInput(ns("username"), label = NULL, placeholder = "Username"),
passwordInput(ns("password"), label = NULL, placeholder = "Password")
)
),
footer = (
fluidRow(
column(6, align="center", offset = 3,
actionButton(ns("signin"),"Sign in")
)
)
)
)
)
}
From what I've seen in other projects, the "inst" folder seems to be the way to go but I'm still new to R packages so I don't really know what I'm doing. Any help on this is much appreciated, thanks!