-
Notifications
You must be signed in to change notification settings - Fork 297
[WIP] Add wrench icon #121
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
base: main
Are you sure you want to change the base?
Changes from all commits
b22787f
934ff24
4cf4ad5
19221ee
016bc37
31102cf
7e2d8ee
98c0c3d
aa7f097
4eff21f
97a1581
fc9413f
06d00b4
7e7f2a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,7 +119,8 @@ infoBox <- function(title, value = NULL, subtitle = NULL, | |
#' the user to collapse the box. | ||
#' @param collapsed If TRUE, start collapsed. This must be used with | ||
#' \code{collapsible=TRUE}. | ||
#' @param ... Contents of the box. | ||
#' @param ... Contents of the box/boxItem. | ||
#' @param boxMenu Adds a box menu consisting of \link{boxItem}. | ||
#' | ||
#' @family boxes | ||
#' | ||
|
@@ -250,7 +251,8 @@ infoBox <- function(title, value = NULL, subtitle = NULL, | |
#' @export | ||
box <- function(..., title = NULL, footer = NULL, status = NULL, | ||
solidHeader = FALSE, background = NULL, width = 6, | ||
height = NULL, collapsible = FALSE, collapsed = FALSE) { | ||
height = NULL, collapsible = FALSE, collapsed = FALSE, | ||
boxMenu = NULL) { | ||
|
||
boxClass <- "box" | ||
if (solidHeader || !is.null(background)) { | ||
|
@@ -278,25 +280,26 @@ box <- function(..., title = NULL, footer = NULL, status = NULL, | |
titleTag <- h3(class = "box-title", title) | ||
} | ||
|
||
boxTools <- NULL | ||
collapseTag <- NULL | ||
if (collapsible) { | ||
buttonStatus <- status %OR% "default" | ||
|
||
if (collapsible) { | ||
collapseIcon <- if (collapsed) "plus" else "minus" | ||
|
||
collapseTag <- div(class = "box-tools pull-right", | ||
tags$button(class = paste0("btn btn-box-tool"), | ||
`data-widget` = "collapse", | ||
shiny::icon(collapseIcon) | ||
) | ||
) | ||
collapseTag <- tags$button(class = "btn btn-box-tool", | ||
`data-widget` = "collapse", | ||
shiny::icon(collapseIcon)) | ||
} | ||
|
||
if (!is.null(collapseTag) || !is.null(boxMenu)) { | ||
boxTools <- div(class = "box-tools pull-right", collapseTag, boxMenu) | ||
} | ||
|
||
headerTag <- NULL | ||
if (!is.null(titleTag) || !is.null(collapseTag)) { | ||
if (!is.null(titleTag) || !is.null(boxTools)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't |
||
headerTag <- div(class = "box-header", | ||
titleTag, | ||
collapseTag | ||
boxTools | ||
) | ||
} | ||
|
||
|
@@ -310,6 +313,26 @@ box <- function(..., title = NULL, footer = NULL, status = NULL, | |
) | ||
} | ||
|
||
#' @inheritParams box | ||
#' @param icon Default icon (if boxMenu is used) is wrench | ||
#' @rdname box | ||
#' @export | ||
boxItem <- function(..., icon = shiny::icon("wrench")) { | ||
listOfValues <- list(...) | ||
# include each arg into <li> </li> tags | ||
listOfLi <- lapply(listOfValues, tags$li) | ||
|
||
tags$div(class = "btn-group", | ||
tags$button(class = "btn btn-box-tool dropdown-toggle", | ||
`type` = "button", | ||
`data-toggle` = "dropdown", | ||
icon), | ||
tags$ul(class = "dropdown-menu", | ||
`role` = "menu", | ||
listOfLi) | ||
) | ||
} | ||
|
||
#' Create a tabbed box | ||
#' | ||
#' @inheritParams shiny::tabsetPanel | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After deep thinking:
Not so much sure if
wrench=
should be boolean. Rather something liketags$li =
....EDIT:see below