Skip to content

Commit

Permalink
add profile card, ...
Browse files Browse the repository at this point in the history
  • Loading branch information
DivadNojnarg committed Oct 14, 2018
1 parent 0dd6f75 commit 649b981
Show file tree
Hide file tree
Showing 11 changed files with 248 additions and 5 deletions.
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ export(argonCard)
export(argonColumn)
export(argonIcon)
export(argonImage)
export(argonPersp)
export(argonProfile)
export(argonProfileStat)
export(argonProfileStats)
export(argonProgress)
export(argonSection)
export(argonTab)
Expand Down
2 changes: 1 addition & 1 deletion R/argonBadge.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ argonBadge <- function(text = NULL, src = NULL, pill = FALSE, status = "default"

badgeCl <- "badge"
if (pill) badgeCl <- paste0(badgeCl, " badge-pill")
if (status) badgeCl <- paste0(badgeCl, " badge-", status)
if (!is.null(status)) badgeCl <- paste0(badgeCl, " badge-", status)

if (!is.null(src)) {
htmltools::a(href = src, class = badgeCl, text)
Expand Down
1 change: 1 addition & 0 deletions R/argonImage.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ argonImage <- function(src = NULL, url = NULL, floating = FALSE, card_mode = FAL
class = cardCl,
htmltools::tags$a(
href = url,
target = "_blank",
htmltools::img(
class = "card-img",
src = src
Expand Down
21 changes: 21 additions & 0 deletions R/argonPersp.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#' Create a Boostrap 4 perspective effect
#'
#' Build an argon perspective effect
#'
#' @param ... Tag to be treated by the persp effect.
#' @param side Perspective side effect. "right" or "left".
#'
#' @examples
#' if (interactive()) {
#' library(argonR)
#' argonPersp(argonCard(), side = "right")
#' }
#'
#' @note Disabled on small screens (not a bug)
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
argonPersp <- function(..., side) {
htmltools::tags$div(class = paste0("transform-perspective-", side), ...)
}
115 changes: 115 additions & 0 deletions R/argonProfile.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#' Create a Boostrap 4 profile card
#'
#' Build an argon profile card
#'
#' @param ... Any element.
#' @param title Profile title.
#' @param subtitle Profile subtitle.
#' @param src Profile image path or url.
#' @param url Main url.
#' @param url_1 First social link.
#' @param url_2 Second social link.
#' @param stats Stats items. See \link{argonProfileStats}.
#'
#' @examples
#' if (interactive()) {
#' }
#'
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
argonProfile <- function(..., title = NULL, subtitle = NULL, src = NULL, url = NULL,
url_1 = NULL, url_2 = NULL, stats) {
htmltools::tags$div(
class = "card card-profile shadow mt--300",
htmltools::tags$div(
class = "px-4",
# header
htmltools::tags$div(
class = "row justify-content-center",
# profile image
htmltools::tags$div(
class = "col-lg-3 order-lg-2",
htmltools::tags$div(
class = "card-profile-image",
htmltools::a(
href = NULL,
htmltools::img(src = src, class = "rounded-circle")
)
)
),
# button
htmltools::tags$div(
class = "col-lg-4 order-lg-3 text-lg-right align-self-lg-center",
htmltools::tags$div(
class = "card-profile-actions py-4 mt-lg-0",
htmltools::a(href = NULL, class = "btn btn-sm btn-info mr-4", url_1),
htmltools::a(href = NULL, class = "btn btn-sm btn-default float-right", url_2)
)
),
# stat items
stats
),

# Title
htmltools::tags$div(
class = "text-center mt-5",
htmltools::h3(title),
htmltools::tags$div(class = "h6 font-weight-300", subtitle)
),

# Content
htmltools::tags$div(
class = "mt-5 py-5 border-top text-center",
htmltools::tags$div(
class = "row justify-content-center",
htmltools::tags$div(
class = "col-lg-9",
htmltools::p(...),
htmltools::a(href = , "More")
)
)
)
)
)
}



#' Create a Boostrap 4 profile card stats container
#'
#' Build an argon profile card stats container
#'
#' @param ... Slot for \link{argonProfileStat}.
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
argonProfileStats <- function(...) {
htmltools::tags$div(
class = "col-lg-4 order-lg-1",
htmltools::tags$div(
class = "card-profile-stats d-flex justify-content-center",
...
)
)
}


#' Create a Boostrap 4 profile card stat item
#'
#' Build an argon profile card stat item
#'
#' @param value Stat value.
#' @param description Stat description.
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
argonProfileStat <- function(value, description) {
htmltools::tags$div(
htmltools::span(class = "heading", value),
htmltools::span(class = "description", description)
)
}
5 changes: 2 additions & 3 deletions R/argonProgress.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ argonProgress <- function(value, text = "Task completed", status = "primary") {
progressTag <- htmltools::tagAppendChildren(
progressTag,
progressLabel,
progressPercent,
progressBar
progressPercent
)

htmltools::tagAppendChild(progressWrapper, progressTag)
htmltools::tagAppendChildren(progressWrapper, progressTag, progressBar)


}
2 changes: 1 addition & 1 deletion R/argonSection.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ argonSection <- function(..., size = NULL, status = "default", gradient = FALSE,
}

htmltools::tags$section(
class = "sectionCl",
class = sectionCl,
htmltools::tags$div(
class = "container",
...
Expand Down
29 changes: 29 additions & 0 deletions man/argonPersp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions man/argonProfile.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions man/argonProfileStat.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions man/argonProfileStats.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 649b981

Please sign in to comment.