Skip to content

Commit

Permalink
fix: uirender uses semantic.assets.
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubnowicki committed Dec 22, 2023
1 parent d0ded2c commit d88aafb
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 53 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
@@ -1,7 +1,7 @@
Package: shiny.semantic
Type: Package
Title: Semantic UI Support for Shiny
Version: 0.4.3.9001
Version: 0.4.3.9002
Authors@R: c(person("Filip", "Stachura", email = "filip@appsilon.com", role = "aut"),
person("Dominik", "Krzeminski", email = "dominik@appsilon.com", role = "aut"),
person("Krystian", "Igras", email = "krystian@appsilon.com", role = "aut"),
Expand Down Expand Up @@ -40,7 +40,7 @@ Imports:
grDevices,
glue,
R6,
semantic.assets
semantic.assets (>= 1.1.0)
Suggests:
dplyr,
tibble,
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Expand Up @@ -6,6 +6,8 @@

- Remove unnecessary warning in `checkboxInput` when `width` is set to `NULL`.

- `uirender` uses assets from `semantic.assets`.

# [shiny.semantic 0.4.3](https://github.com/Appsilon/shiny.semantic/releases/tag/0.4.3)

- Removed inline-styled min-height from `<body>`.
Expand Down
33 changes: 12 additions & 21 deletions R/uirender.R
Expand Up @@ -5,7 +5,7 @@
#'
#' @import htmlwidgets
#'
#' @param ui UI, which will be wraped in an htmlwidget.
#' @param ui UI, which will be wrapped in an htmlwidget.
#' @param width Fixed width for widget (in css units). The default is NULL,
#' which results in intelligent automatic sizing.
#' @param height Fixed height for widget (in css units). The default is NULL,
Expand All @@ -15,27 +15,18 @@
#' @examples
#' library(shiny)
#' library(shiny.semantic)
#' uirender(card(div(class="content",
#' div(class="header", "Elliot Fu"),
#' div(class="meta", "Friend"),
#' div(class="description", "Elliot Fu is a film-maker from New York."))))
#' uirender(
#' card(
#' div(
#' class="content",
#' div(class="header", "Elliot Fu"),
#' div(class="meta", "Friend"),
#' div(class="description", "Elliot Fu is a film-maker from New York.")
#' )
#' )
#' )
#'
#' @export
uirender <- function(ui, width = NULL, height = NULL, element_id = NULL) {

# forward options using x
args <- list(
ui = toString(ui),
shiny_custom_semantic = get_dependencies_path()$src[[1]]
)

# create widget
htmlwidgets::createWidget(
name = "uirender",
args,
width = width,
height = height,
package = "shiny.semantic",
elementId = element_id
)
semantic.assets::uirender(ui, width = width, height = height, element_id = element_id)
}
24 changes: 24 additions & 0 deletions examples/uirender/uirender.Rmd
@@ -0,0 +1,24 @@
---
title: "Test renderui"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(shiny)
library(shiny.semantic)
```

```{r}
uirender(
card(
div(
class = "content",
div(class = "header", "Elliot Fu"),
div(class = "meta", "Friend"),
div(class = "description", "Elliot Fu is a film-maker from New York.")
)
)
)
```
24 changes: 0 additions & 24 deletions inst/htmlwidgets/uirender.js

This file was deleted.

1 change: 0 additions & 1 deletion inst/htmlwidgets/uirender.yaml

This file was deleted.

16 changes: 11 additions & 5 deletions man/uirender.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d88aafb

Please sign in to comment.