Skip to content
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: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# bslib (development version)

## Improvements and bug fixes

* The brand.yml example app (`shiny::runExample("brand.yml", package = "bslib")`) now uses `brand_pluck()` and `brand_has()` from `{brand.yml}`. (#1288)

# bslib 0.10.0

## Breaking changes
Expand Down
14 changes: 8 additions & 6 deletions inst/examples-shiny/brand.yml/app.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
rlang::check_installed("shiny", version = "1.8.1")
rlang::check_installed("bslib", version = "0.8.0.9000")
rlang::check_installed("brand.yml")
rlang::check_installed("future")
rlang::check_installed("ggplot2")
rlang::check_installed("markdown")

library(shiny)
library(bslib)
library(brand.yml)
library(ggplot2)

library(future)
Expand All @@ -24,7 +26,7 @@ BRAND_PATH <- brand$path %||% "_brand.yml"
theme_set(theme_minimal())

if (requireNamespace("thematic", quietly = TRUE)) {
base_font <- bslib:::brand_pluck(brand, "typography", "base", "family")
base_font <- brand_pluck(brand, "typography", "base", "family")
if (!is.null(base_font)) {
# TODO: Update plot fonts dynamically
thematic::thematic_shiny(font = base_font)
Expand All @@ -43,7 +45,7 @@ is_app_packaged <-
getwd() == system.file("examples-shiny/brand.yml", package = "bslib")
use_download_button <- is_app_hosted || is_app_packaged

if (bslib:::brand_has(brand, "typography", "fonts")) {
if (brand_has(brand, "typography", "fonts")) {
tryCatch(
{
if (brand$typography$fonts[[2]]$files[[1]]$path == "Monda.ttf") {
Expand Down Expand Up @@ -437,8 +439,8 @@ server <- function(input, output, session) {

output$brand_name <- renderUI({
brand_name <-
bslib:::brand_pluck(brand_yml(), "meta", "name", "short") %||%
bslib:::brand_pluck(brand_yml(), "meta", "name")
brand_pluck(brand_yml(), "meta", "name", "short") %||%
brand_pluck(brand_yml(), "meta", "name")

if (rlang::is_string(brand_name)) brand_name else "brand.yml Demo"
})
Expand All @@ -447,8 +449,8 @@ server <- function(input, output, session) {
brand <- brand_yml()

logo <-
bslib:::brand_pluck(brand, "logo", "small") %||%
bslib:::brand_pluck(brand, "logo")
brand_pluck(brand, "logo", "small") %||%
brand_pluck(brand, "logo")

req(rlang::is_string(logo))

Expand Down