Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Pricing Table Reactivity non-existent #18

Open
xbrl-data opened this issue Jul 25, 2020 · 5 comments
Open

Pricing Table Reactivity non-existent #18

xbrl-data opened this issue Jul 25, 2020 · 5 comments

Comments

@xbrl-data
Copy link

I love the look of this package, but when I try to use the pricing table defaults from the documentation, there is no reactivity at all. Clicking a button in the bulmaPricingPlanItem seems to do absolutely nothing. Am I missing something here?

bulmaPricingPlan( active = TRUE, color = NULL, plan_title = "Growing Team", plan_price = 60, plan_currency = "$", plan_period = "/month", button_status = NULL, button_name = "Choose", bulmaPricingPlanItem(name = "200GB Storage"), bulmaPricingPlanItem(name = "50 domains"), bulmaPricingPlanItem(name = "1TB Bandwidth"), bulmaPricingPlanItem(name = "100 Email Boxes") )

@DivadNojnarg
Copy link
Member

Hi,

thanks for your interest in shinybulma. For now, the pricing table is not interactive. What you could to is to add an id to the given button as well as add the action-button class to make it react like a classic shiny action button. On the server side, you may detect any click on that button using the corresponding inputId in an observeEvent.

In a future release, this will be included by default. For now, the reason it was not done is mainly a lack of free time to maintain the package.

Best

David

@fmmattioni
Copy link

Hey @DivadNojnarg!

Would you be able to provide a very quick example of what you described above?

I am currently working with shinybulma and I find it fantastic! I am actually adapting the pricing plan table for something else. It would be great if I could add this reactivity.

Thanks in advance!
Felipe

@fmmattioni
Copy link

Actually, nevermind.. I am going to use bs4Dash 😁

@DivadNojnarg
Copy link
Member

DivadNojnarg commented Oct 2, 2020

You would have to modify the bulmaPricingPlan to add an id to the button as well as add the action-button class to inherit from the shiny action button behavior. Alternatively, you could replace the button by bulmaActionButton and feed it with the id:

bulmaPricingPlan <- function(..., active = FALSE, color = NULL, plan_title = NULL,
                             plan_price = NULL, plan_currency = NULL,
                             plan_period = NULL, button_status = NULL,
                             button_name = NULL, id = NULL) {

  cl <- "pricing-plan"
  if (!is.null(color)) cl <- paste0(cl, " is-", color)
  if (active == TRUE) cl <- paste0(cl, " is-active")


  # main tag
  pricingPlanTag <- shiny::tags$div(
    class = cl
  )

  # header
  headerTag <- shiny::tags$div(class = "plan-header", plan_title)

  # price
  priceTag <- shiny::tags$div(
    class = "plan-price",
    shiny::tags$span(
      class = "plan-price-amount",
      shiny::tags$span(class = "plan-price-currency", plan_currency),
      plan_price
    ),
    plan_period
  )

  # items
  itemsTag <- shiny::tags$div(
    class = "plan-items",
    # items
    ...
  )
  # footer
  footerTag <- shiny::tags$div(
    class = "plan-footer"
  )

  # footer button
  footerButtonTag <- shiny::tags$button(
    id = id,
    class = "button action-button is-fullwidth",
    button_name
  )

  if (!is.null(button_status)) footerButtonTag$attribs$disabled <- button_status

  footerTag <- shiny::tagAppendChild(footerTag, footerButtonTag)

  pricingPlanTag <- shiny::tagAppendChildren(
    pricingPlanTag,
      headerTag,
      priceTag,
      itemsTag,
      footerTag
  )

  pricingPlanTag

}

@fmmattioni
Copy link

Hi @DivadNojnarg, this is perfect! I am going to give it a try again, really like shinybulma!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants