Skip to content

Commit c63aea0

Browse files
bowerthgadenbuie
andauthored
use functions from brand.yml package (#1288)
* use functions from brand.yml package * drop brand.yml:: prefix, add news entry * chore: adjust news bullet --------- Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
1 parent 9bd1a89 commit c63aea0

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# bslib (development version)
22

3+
## Improvements and bug fixes
4+
5+
* The brand.yml example app (`shiny::runExample("brand.yml", package = "bslib")`) now uses `brand_pluck()` and `brand_has()` from `{brand.yml}`. (#1288)
6+
37
# bslib 0.10.0
48

59
## Breaking changes

inst/examples-shiny/brand.yml/app.R

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
rlang::check_installed("shiny", version = "1.8.1")
22
rlang::check_installed("bslib", version = "0.8.0.9000")
3+
rlang::check_installed("brand.yml")
34
rlang::check_installed("future")
45
rlang::check_installed("ggplot2")
56
rlang::check_installed("markdown")
67

78
library(shiny)
89
library(bslib)
10+
library(brand.yml)
911
library(ggplot2)
1012

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

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

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

438440
output$brand_name <- renderUI({
439441
brand_name <-
440-
bslib:::brand_pluck(brand_yml(), "meta", "name", "short") %||%
441-
bslib:::brand_pluck(brand_yml(), "meta", "name")
442+
brand_pluck(brand_yml(), "meta", "name", "short") %||%
443+
brand_pluck(brand_yml(), "meta", "name")
442444

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

449451
logo <-
450-
bslib:::brand_pluck(brand, "logo", "small") %||%
451-
bslib:::brand_pluck(brand, "logo")
452+
brand_pluck(brand, "logo", "small") %||%
453+
brand_pluck(brand, "logo")
452454

453455
req(rlang::is_string(logo))
454456

0 commit comments

Comments
 (0)