Skip to content

Commit

Permalink
fix #16 (icon arg on most of argonR elements) to use shiny::icon or a…
Browse files Browse the repository at this point in the history
…rgonR::argonIcon
  • Loading branch information
DivadNojnarg committed Jun 5, 2019
1 parent 7a110c0 commit fcdbb6d
Show file tree
Hide file tree
Showing 18 changed files with 596 additions and 578 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# argonR 0.2.0.9000
- change the icon parameter of `argonTabSet()`, `argonCard()`, `argonAlert()`,
`argonDropdownItem()` and `argonNavItem()`
Now you can use `icon("cogs")` from shiny or `argonIcon()` as usual
- add offset arg to `argonColumn()`
- Add btn_text argument to `argonCard()`
- Fix #1: headroom.js and add the corresponding argument to `argonNavbar()`
Expand Down
6 changes: 3 additions & 3 deletions R/argonAlert.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
#' Build an argon alert
#'
#' @param ... Alert content.
#' @param icon Alert icon.
#' @param icon Alert icon. Expect \link{argonIcon} or \link[shiny]{icon}.
#' @param status Alert status. See \url{https://demos.creative-tim.com/argon-design-system/docs/components/alerts.html}.
#' @param closable Whether to make the alert closable or not. TRUE by default.
#'
#' @examples
#' if (interactive()) {
#' library(argonR)
#' argonAlert(
#' icon = "basket",
#' icon = argonIcon("basket"),
#' status = "danger",
#' "This is an alert",
#' closable = TRUE
Expand All @@ -33,7 +33,7 @@ argonAlert <- function(..., icon = NULL, status = "default", closable = TRUE) {
if (!is.null(icon)) {
htmltools::tags$span(
class = "alert-inner--icon",
argonIcon(icon)
icon
)
},
htmltools::tags$span(
Expand Down
8 changes: 4 additions & 4 deletions R/argonCard.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' @param shadow_size Card shadow size. Only if shadow is TRUE. NULL by default.
#' @param hover_shadow Only if shadow is TRUE. Whether to enlarge the shadow on hover. FALSE by default.
#' @param border_level Border level. O by default.
#' @param icon Card icon.
#' @param icon Card icon. Expect \link{argonIcon} or \link[shiny]{icon}.
#' @param btn_text Button text. src arg must not be NULL so that this button appears.
#' @param status Card status. See \url{https://demos.creative-tim.com/argon-design-system/docs/foundation/colors.html}.
#' @param background_color Card background color. NULL by default. See \url{https://demos.creative-tim.com/argon-design-system/docs/foundation/colors.html}.
Expand All @@ -29,7 +29,7 @@
#' title = "Card 1",
#' hover_lift = TRUE,
#' shadow = TRUE,
#' icon = "check-bold",
#' icon = argonIcon("check-bold"),
#' src = "#",
#' "Argon is a great free UI package based on Bootstrap 4
#' that includes the most important components and features."
Expand Down Expand Up @@ -84,7 +84,7 @@ argonCard <- function(..., title = NULL, src = NULL, hover_lift = FALSE,
if (!is.null(title)) {
htmltools::tags$div(
class = if (!is.null(background_color)) {
"cqrd-header bg-transparent"
"card-header bg-transparent"
} else {
"card-header"
},
Expand All @@ -93,7 +93,7 @@ argonCard <- function(..., title = NULL, src = NULL, hover_lift = FALSE,
# icon
if(!is.null(icon)) {
argonIconWrapper(
iconTag = argonIcon(name = icon, color = status),
iconTag = icon,
circle = TRUE,
size = "sm",
shadow = TRUE,
Expand Down
8 changes: 4 additions & 4 deletions R/argonNavbar.R
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ argonNavMenu <- function(..., side = "left") {
#'
#' @param name Item name.
#' @param src HTML target page.
#' @param icon Item icon of any.
#' @param icon Item icon of any. Expect \link{argonIcon} or \link[shiny]{icon}.
#' @param tooltip Text to display when the item is hovered.
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
Expand All @@ -195,7 +195,7 @@ argonNavItem <- function(name = NULL, src = NULL, icon = NULL, tooltip = NULL) {
`data-toggle` = "tooltip",
title = "",
`data-original-title` = tooltip,
htmltools::tags$i(class = paste0("fa fa-", icon)),
icon,
htmltools::tags$span(class = "nav-link-inner--text d-lg-none", name)
)
)
Expand Down Expand Up @@ -246,7 +246,7 @@ argonDropdown <- function(..., name, size = NULL) {
#' @param name Item name.
#' @param description Item description if any.
#' @param src HTML target page.
#' @param icon Item icon of any.
#' @param icon Item icon of any. Expect \link{argonIcon} or \link[shiny]{icon}.
#' @param status Icon and name color status. See \url{https://demos.creative-tim.com/argon-design-system/docs/foundation/colors.html}.
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
Expand All @@ -260,7 +260,7 @@ argonDropdownItem <- function(name = NULL, description = NULL, src = NULL,
# icon if any
if (!is.null(icon)) {
argonIconWrapper(
iconTag = argonIcon(icon, color = "white"),
iconTag = icon,
gradient_color = status,
circle = TRUE,
size = NULL,
Expand Down
10 changes: 7 additions & 3 deletions R/argonTabs.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#' @param circle Whether to display circled design. FALSE by default.
#' @param size Tabs size. "sm" by default. "md", "lg".
#' @param width Tabs width. Between 1 and 12.
#' @param iconList A list of argonIcon such as list("atom", "cloud-upload-96").
#' @param iconList A list of \link{argonIcon} or \link[shiny]{icon}.
#' The lenght must have the same length as the number of tabs. NULL by default.
#'
#' @examples
Expand All @@ -22,7 +22,11 @@
#' circle = FALSE,
#' size = "sm",
#' width = 6,
#' iconList = list("cloud-upload-96", "bell-55", "calendar-grid-58"),
#' iconList = list(
#' argonIcon("cloud-upload-96"),
#' argonIcon("bell-55"),
#' argonIcon("calendar-grid-58")
#' ),
#' argonTab(
#' tabName = "Tab 1",
#' active = FALSE,
Expand Down Expand Up @@ -97,7 +101,7 @@ argonTabSet <- function(..., id, card_wrapper = FALSE, horizontal = TRUE, circle
role = "tab",
`aria-controls` = ns(current_item_id),
`aria-selected` = "true",
if (!is.null(iconList)) argonIcon(name = iconList[[i]]),
if (!is.null(iconList)) iconList[[i]],
current_item_name
)
)
Expand Down
Loading

0 comments on commit fcdbb6d

Please sign in to comment.