Skip to content
New issue

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

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

Already on GitHub? # to your account

fix: Don't add bslib-gap-spacing when card body is not fillable #1073

Merged
merged 4 commits into from
Jun 10, 2024

Conversation

gadenbuie
Copy link
Member

@gadenbuie gadenbuie commented Jun 10, 2024

When card_body(fillable = FALSE, ...) we should not be adding the bslib-gap-spacing class to the card body container.

App Example
library(shiny)
# library(bslib)
pkgload::load_all()
library(leaflet)

ui <- page_fillable(
  card(
    class = "text-bg-light",
    # max_height = "400px",
    card_body(
      fillable = FALSE,
      h3("Lehigh University"),
      lorem::ipsum(3, 1:3 + 1),
      actionButton("visit", "Visit School")
    ),
    card_body(
      leafletOutput("map_lehigh"),
    )
  )
)

server <- function(input, output, session) {
  output$map_lehigh <- renderLeaflet({
    lat  <- 40.60682
    long <- -75.38024
    name <- "Lehigh University"

    leaflet() |>
      addTiles() |>
      setView(lng = long, lat = lat, zoom = 13) |>
      addMarkers(lng = long, lat = lat, popup = name)
  })
}

shinyApp(ui, server)
Before After
image image

@gadenbuie gadenbuie requested a review from cpsievert June 10, 2024 15:44
@cpsievert
Copy link
Collaborator

Looks like there at least a couple other places we unconditionally add this class -- should we be doing the same there?

@gadenbuie
Copy link
Member Author

Looks like there at least a couple other places we unconditionally add this class -- should we be doing the same there?

Yeah probably! If you have the time to add those to this PR, that'd be appreciated.

@gadenbuie gadenbuie merged commit 79138b5 into main Jun 10, 2024
13 checks passed
@gadenbuie gadenbuie deleted the fix/card-body-fillable-gap-spacing branch June 10, 2024 17:09
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants