knitr::opts_chunk$set(echo = TRUE)
library(bs4cards)

locate_thumbnail <- function(x) {
  system.file("extdata", "thumbnail", paste0(x, ".jpg"), package = "bs4cards")
} 
locate_gallery <- function(x) {
  paste0("https://art.djnavarro.net/gallery/", x)
}

galleries
galleries %>% 
  cards(
    title = long_name,
    text = date,
    link = locate_gallery(short_name),
    image = locate_thumbnail(short_name),
    width = "medium",
    layout = "label-below"
  )

Vertical layouts

galleries %>% 
  cards(
    title = long_name,
    link = locate_gallery(short_name),
    image = locate_thumbnail(short_name),
    footer = paste("posted on", date),
    width = "wide",
    layout = "label-above"
  )
galleries %>% 
  cards(
    title = long_name,
    link = locate_gallery(short_name),
    image = locate_thumbnail(short_name),
    text = blurb,
    footer = paste("posted on", date),
    width = "wide",
    layout = "label-below"
  )

Horizontal layouts

galleries %>% 
  cards(
    title = long_name,
    text = blurb,
    link = locate_gallery(short_name),
    image = locate_thumbnail(short_name),
    width = "very-wide",
    layout = "label-left"
  )
galleries %>% 
  cards(
    title = long_name,
    text = blurb,
    link = locate_gallery(short_name),
    image = locate_thumbnail(short_name),
    width = "very-wide",
    footer = paste("posted on", date),
    layout = "label-right",
    breakpoint = 7/12
  )

Inset layouts

galleries %>% 
  cards(
    title = long_name,
    link = locate_gallery(short_name),
    image = locate_thumbnail(short_name),
    width = "wide",
    layout = "inset-top", 
    colour = "#ffffffcc"
  )
galleries %>% 
  cards(
    title = long_name,
    link = locate_gallery(short_name),
    image = locate_thumbnail(short_name),
    width = "wide",
    layout = "inset-bottom", 
    colour = "#ffffffcc", 
    rounding = 0
  )
galleries %>% 
  cards(
    title = long_name,
    footer = blurb,
    link = locate_gallery(short_name),
    image = locate_thumbnail(short_name),
    width = "wide",
    layout = "inset-bottom", 
    colour = "#ffffffcc"
  )
galleries %>% 
  cards(
    title = long_name,
    text = blurb,
    footer = date,
    link = locate_gallery(short_name),
    image = locate_thumbnail(short_name),
    width = "wide",
    layout = "inset-bottom", 
    breakpoint = .5,
    colour = "#ffffffcc"
  )

Tags

galleries %>% 
  cards(
    title = long_name,
    text = blurb,
    link = locate_gallery(short_name),
    image = locate_thumbnail(short_name),
    tags = paste("all", paintbrushes),
    width = "very-wide",
    footer = paintbrushes,
    layout = "label-right",
    breakpoint = 7/12
  )



























djnavarro/bs4cards documentation built on Dec. 20, 2021, 12:04 a.m.