@@ -67,7 +67,11 @@ if (bslib:::brand_has(brand, "typography", "fonts")) {
67
67
68
68
ui <- page_navbar(
69
69
theme = bs_add_rules(theme_brand , sass :: sass_file(" _colors.scss" )),
70
- title = " brand.yml Demo" ,
70
+ title = tagList(
71
+ uiOutput(" brand_icon" , inline = TRUE ),
72
+ uiOutput(" brand_name" , inline = TRUE )
73
+ ),
74
+ window_title = " brand.yml Demo" ,
71
75
fillable = TRUE ,
72
76
73
77
sidebar = sidebar(
@@ -432,6 +436,35 @@ server <- function(input, output, session) {
432
436
)
433
437
})
434
438
439
+ output $ brand_name <- renderUI({
440
+ brand_name <-
441
+ bslib ::: brand_pluck(brand_yml(), " meta" , " name" , " short" ) %|| %
442
+ bslib ::: brand_pluck(brand_yml(), " meta" , " name" )
443
+
444
+ if (rlang :: is_string(brand_name )) brand_name else " brand.yml Demo"
445
+ })
446
+
447
+ output $ brand_icon <- renderUI({
448
+ brand <- brand_yml()
449
+
450
+ logo <-
451
+ bslib ::: brand_pluck(brand , " logo" , " small" ) %|| %
452
+ bslib ::: brand_pluck(brand , " logo" )
453
+
454
+ req(rlang :: is_string(logo ))
455
+
456
+ logo_path <- file.path(dirname(BRAND_PATH ), logo )
457
+ if (file.exists(logo_path )) {
458
+ img(
459
+ src = base64enc :: dataURI(
460
+ file = logo_path ,
461
+ mime = mime :: guess_type(logo_path )
462
+ ),
463
+ height = 30
464
+ )
465
+ }
466
+ })
467
+
435
468
observeEvent(input $ save , {
436
469
validate(
437
470
need(input $ txt_brand_yml , " _brand.yml file contents cannot be empty." )
0 commit comments