Skip to content

Commit

Permalink
Merge pull request #38 from RinteRface/shinylive
Browse files Browse the repository at this point in the history
Shinylive demo support
  • Loading branch information
DivadNojnarg authored Jan 25, 2025
2 parents 73a1606 + bad0e09 commit 49b2f76
Show file tree
Hide file tree
Showing 49 changed files with 4,110 additions and 4,890 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
^CODE_OF_CONDUCT\.md$
^_pkgdown\.yml$
^pkgdown$
^README\.Rmd$
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ BugReports: https://github.com/RinteRface/argonDash/issues
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.0.1
Depends:
R (>= 2.10)
Binary file added R/sysdata.rda
Binary file not shown.
56 changes: 43 additions & 13 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,25 @@ tagAssert <- function(tag, type = NULL, class = NULL, allowUI = TRUE) {
print(tag)
stop("Expected an object with class 'shiny.tag'.")
}

# Skip dynamic output elements
if (allowUI &&
(hasCssClass(tag, "shiny-html-output") ||
hasCssClass(tag, "shinydashboard-menu-output"))) {
if (
allowUI &&
(
hasCssClass(tag, "shiny-html-output") ||
hasCssClass(tag, "shinydashboard-menu-output")
)
) {
return()
}

if (!is.null(type) && tag$name != type) {
stop("Expected tag to be of type ", type)
}

if (!is.null(class)) {
if (is.null(tag$attribs$class)) {
stop("Expected tag to have class '", class, "'")

} else {
tagClasses <- strsplit(tag$attribs$class, " ")[[1]]
if (!(class %in% tagClasses)) {
Expand All @@ -37,19 +40,46 @@ tagAssert <- function(tag, type = NULL, class = NULL, allowUI = TRUE) {
}
}


hasCssClass <- function(tag, class) {
if (is.null(tag$attribs) || is.null(tag$attribs$class))
return(FALSE)

if (is.null(tag$attribs) || is.null(tag$attribs$class)) return(FALSE)

classes <- strsplit(tag$attribs$class, " +")[[1]]
return(class %in% classes)
}


# Make sure a tab name is valid (there's no "." in it).
validateTabName <- function(name) {
if (grepl(".", name, fixed = TRUE)) {
stop("tabName must not have a '.' in it.")
}
}
}

#' Create shinylive iframe
#'
#' Useful for pkgdown website
#'
#' @param url app url. A shinylive link.
#' @param mode How to display the shinylive app. Default to app mode.
#' @param header Whether to display the shinylive header. Default to TRUE.
#' @keywords internal
create_app_link <- function(url, mode = c("app", "editor"), header = TRUE) {
mode <- match.arg(mode)

if (mode != "editor") url <- gsub("editor", mode, url)

if (!header) {
url <- paste0(url, "&h=0")
}

shiny::tags$iframe(
# To allow the content to fill the full screen card
class = "html-fill-item",
src = url,
height = "700",
width = "100%",
style = "border: 1px solid rgba(0,0,0,0.175); border-radius: .375rem;",
allowfullscreen = "",
allow = "autoplay",
`data-external` = "1"
)
}
63 changes: 63 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
output: github_document
---

<!-- README.md is generated from README.Rmd. Please edit that file -->

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# argonDash <img src="http://www.rinterface.com/inst/images/argonDash.svg" width=200 align="right" />

[![R build status](https://github.com/RinteRface/argonDash/workflows/R-CMD-check/badge.svg)](https://github.com/RinteRface/argonDash/actions)
[![CRAN status](https://www.r-pkg.org/badges/version/argonDash)](https://cran.r-project.org/package=argonDash)
[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-ff69b4.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![cranlogs](https://cranlogs.r-pkg.org/badges/argonDash)](https://cran.r-project.org/package=argonDash)
[![total](https://cranlogs.r-pkg.org/badges/grand-total/argonDash)](https://www.rpackages.io/package/argonDash)

> argon Bootstrap4 dashboard template for Shiny
## Installation

`{argonDash}` requires to install `{argonR}`.

```r
install.packages("argonR")
# devel version
devtools::install_github("RinteRface/argonDash")
# from CRAN
install.packages("argonDash")
```

## Demo

```r
library(argonDash)
argonDashGallery()
```

### Vertical layout
<br>
<img src="man/figures/argonDashDemo.png">

### Horizontal layout

This layout is experimental.

<br>
<img src="man/figures/argonDashDemo_horizontal.png">

## Aknowledgement

* [Creative Tim](https://www.creative-tim.com/) for designing the original argon dashboard HTML template.

## Code of Conduct

Please note that the argonDash project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.

30 changes: 19 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# argonDash <img src="http://www.rinterface.com/inst/images/argonDash.svg" width=200 align="right" />

[![R build status](https://github.com/RinteRface/argonDash/workflows/R-CMD-check/badge.svg)](https://github.com/RinteRface/argonDash/actions)
[![CRAN status](https://www.r-pkg.org/badges/version/argonDash)](https://cran.r-project.org/package=argonDash)
[![R build
status](https://github.com/RinteRface/argonDash/workflows/R-CMD-check/badge.svg)](https://github.com/RinteRface/argonDash/actions)
[![CRAN
status](https://www.r-pkg.org/badges/version/argonDash)](https://cran.r-project.org/package=argonDash)
[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-ff69b4.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![cranlogs](https://cranlogs.r-pkg.org/badges/argonDash)](https://cran.r-project.org/package=argonDash)
[![total](https://cranlogs.r-pkg.org/badges/grand-total/argonDash)](https://www.rpackages.io/package/argonDash)
Expand All @@ -12,7 +17,7 @@

`{argonDash}` requires to install `{argonR}`.

```r
``` r
install.packages("argonR")
# devel version
devtools::install_github("RinteRface/argonDash")
Expand All @@ -22,26 +27,29 @@ install.packages("argonDash")

## Demo

```r
``` r
library(argonDash)
argonDashGallery()
```

### Vertical layout
<br>
<img src="man/figures/argonDashDemo.png">

<br> <img src="man/figures/argonDashDemo.png">

### Horizontal layout

This layout is experimental.

<br>
<img src="man/figures/argonDashDemo_horizontal.png">
<br> <img src="man/figures/argonDashDemo_horizontal.png">

## Aknowledgement

* [Creative Tim](https://www.creative-tim.com/) for designing the original argon dashboard HTML template.
- [Creative Tim](https://www.creative-tim.com/) for designing the
original argon dashboard HTML template.

## Code of Conduct

Please note that the argonDash project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.

Please note that the argonDash project is released with a [Contributor
Code of
Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html).
By contributing to this project, you agree to abide by its terms.
8 changes: 4 additions & 4 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ reference:
- '`argonDashGallery`'

template:
params:
bootswatch: journal


bootstrap: 5

navbar:
structure:
left:
Expand All @@ -69,8 +67,10 @@ navbar:
icon: fa-github fa-lg
href: https://github.com/RinteRface/argonDash

url: https://rinterface.github.io/argonDash/

news:
releases:
- text: "argonDash 0.3.0.9000"
- text: "argonDash 0.2.0"
- text: "argonDash 0.1.0"
Loading

0 comments on commit 49b2f76

Please sign in to comment.