Skip to content

Centered icon for button when empty label#83

Open
bilbaoba wants to merge 1 commit intoericrayanderson:masterfrom
bilbaoba:center_icon_if_empty_label
Open

Centered icon for button when empty label#83
bilbaoba wants to merge 1 commit intoericrayanderson:masterfrom
bilbaoba:center_icon_if_empty_label

Conversation

@bilbaoba
Copy link
Contributor

Hi Eric & shinymaterial users,

I propose to center the icon for button when label is null or empty.

Changes :

  • Re write of code for material_button and material_modal functions
  • Improvement & simplification of code

Test :

After install the package :

library(shiny)
library(shinymaterial)

ui <- material_page(
  title = "Basic Page",
  tags$h1("Page Content"),
  material_row(
    material_column(
      material_button("test", label = "", icon = "add", depth = 5, color = "red"),
      material_button("test2", label = NULL, icon = "add"),
      material_modal("test3", button_text = "", title = "Test3", button_icon = "add"),
      material_modal("test4", button_text = NULL, title = "Test4", button_icon = "add", floating_button = T)
    )
  )
)

server <- function(input, output) {}
shinyApp(ui = ui, server = server)

Best regards.

@bilbaoba
Copy link
Contributor Author

I add minor modification to the class of a modal button to correct a bug I saw when you use in the same row a modal button and a regular button.
Simply add the shiny material-button class and it correct everything.

@Seyphaton
Copy link

Thanks - manipulating the CSS properties for each button is quite a pain

@bilbaoba
Copy link
Contributor Author

Hi @ericrayanderson,

I test this PR and it's working with the new version of package (v1.0.0).

Regards.

@bilbaoba
Copy link
Contributor Author

Hi Everyone, @ericrayanderson,

I just had a minor correction with modal. It appears modal won't open since we use materialize-v1.0.0.js. This last commit correct this minor bug.

Also I read about few more options we can had to modals (https://materializecss.com/modals.html) : modals with fixed footer and bottom sheet modals. I don't know if Eric want to keep the package the simplest possible or if we can provide the most of possibility with materialize.

I can quickly had two options in the material_modal() function : fixed_footer = F and bottom_sheet_modal=F to implement those possibilities if Eric approve.

Thanks.

@bilbaoba bilbaoba force-pushed the center_icon_if_empty_label branch from 94ad10c to ca34962 Compare January 29, 2020 17:54
@ericrayanderson
Copy link
Owner

@bilbaoba - this fix has been implemented in v1.0.1.

Thank you for catching and solving that bug.

@bilbaoba bilbaoba force-pushed the center_icon_if_empty_label branch 2 times, most recently from d0cdd72 to f40562b Compare February 6, 2020 04:58
@bilbaoba bilbaoba force-pushed the center_icon_if_empty_label branch from f40562b to 1ff1815 Compare February 6, 2020 05:18
@bilbaoba
Copy link
Contributor Author

bilbaoba commented Feb 6, 2020

@ericrayanderson I rebase my branch onto the last version of the package with a unique commit.

This PR still correct :

  • center the icon for button or modal when label is null or empty.
  • rewrite of code for material_button and material_modal functions (improvement & simplification)
  • align modal button with other button

To test :

library(shiny)
library(shinymaterial)

ui <- material_page(
  title = "Basic Page",
  tags$h1("Page Content"),
  material_row(
    material_column(
      material_button("test", label = "", icon = "add", depth = 5, color = "red"),
      material_button("test2", label = NULL, icon = "add"),
      material_modal("test3", button_text = "", title = "Test3", button_icon = "add"),
      material_modal("test4", button_text = NULL, title = "Test4", button_icon = "add", floating_button = T)
    )
  )
)

server <- function(input, output) {}
shinyApp(ui = ui, server = server)

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

Successfully merging this pull request may close these issues.

3 participants