Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: uirender uses semantic.assets. #450

Merged
merged 2 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: "`uirender` example"
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.